The alpha, twice a week
That was 3 min.
Get the best new moments in your inbox every Wednesday and Saturday. It's free.
Check your inbox
We sent a link to your address. Click it to finish signing up. Not there in a minute? Look in spam.
or
Latent Space · 3 min · Jun 24, 2026
Agent security needs policies that track session context
Matei Zaharia explains how stateful policies can allow useful actions while blocking risky combinations.
The episode’s best minutes
Full analysis- 19:19Agent security needs policies that track session context3 min
- 35:30LTAP grew out of a prototype that wrote database data to Parquet3 min
- 44:58Databricks is building a database engine from workload tracesPro pick 7 min
- 5 more moments in the full episode
“So the thing we decided we need is stateful or what we call contextual policies, where you keep track of the state of that session.”
Matei Zahariaat 20:23 · Latent SpaceTakeaways
- Track what the agent has done, not just which tools it can use.
- Block risky combinations, such as reading secrets and publishing content.
- Cap a session’s spend and ask permission before going over budget.
About this segment
Matei Zaharia explains how stateful policies can allow useful actions while blocking risky combinations. Session-level spend caps can also stop agents from running up unexpected bills.
Co-founder, Databricks
Created Apache Spark during his PhD and co-founded Databricks, where he helped build MLflow and Delta Lake.

Shawn Wang (swyx), Host · Co-founder, AI Engineer
Wrote “The Rise of the AI Engineer” and founded Smol AI, maker of AI News.
From “The Agent Cloud: Databricks’ Bet on the Future of AI — Matei Zaharia and Reynold Xin”, Jun 24, 2026. Watch the full episode
Thanks. We'll look at and fix what's off.
Transcript
From the transcript Latent Space publishes with the episode.
- 19:23
Yeah, so I spent quite a bit of time talking to internal users, uh, developers, security team, you know, uh, uh, managers, a- and also lots of customers. And there's a few things. Like, first of all, one thing, you know, that immediately was... became obvious is for security, uh, you know, there's this tension between, like, usability and security. And, um, the way people do, like, a lot of coding agents today have very basic things like you can tell me which tool patterns I'll allow or disallow or whatever. It's like yes or no.
- 19:55
But that puts you in a very tough spot. So just as an example, like, should my agent be able to read, you know, some confidential documents? Or, or, or let's say, should it be able to install new packages from NPM, which, you know, maybe it's, uh, it's compromised. Yes or no? Like, maybe, maybe I wanna allow it. Should my agent be able to publish stuff to the company website? Well, if I'm using it to code on the website, yes. But should it be able to do both so it can, like- Hmm...
- 20:22
grab a confidential document and be prompt injected and leak it? Probably not. So the thing we decided we need is stateful or what we call contextual policies, where you keep track of the state of that session. It's not like is it allowed to push to the marketing site or not, but like, hey, if it did a risky thing, like it installed, you know, a [laughs] one-day-old package from NPM, or it, it read, like, 1,000 confidential docs, then no.
- 20:49
Then don't, don't do it. Otherwise, maybe it's okay. That's one example of, like, moving that trade-off so it's both more secure and more useful by having a more powerful engine, essentially. This requires tracking sessions. The other piece that was interesting there is, like, there are these very low-level events it's doing, and you want some libraries on top that parse them. Like, for example, we have a, uh, MCP server on Google Drive internally. It's got 60 API calls. Um, like, how do I know which of those, like, will share a document with stuff on the internet and which ones won't?
- 21:21
It, it's, it's annoying. So we designed i- in Omnigin the policy layer so that it's, it's functions and you can have libraries. Like, someone can make something that maps the low-level events to high-level ones, and then you write a policy about the high-level things that came out. Um, so and that was- This is related to the Panther, uh- Yeah, Pa- Panther is... will help with that. Panther is- Yeah...
- 21:42
kind of a similar idea on the event processing side, and it's Python-based versus a weird custom language. Uh, this is sort of more as in real- [laughs] Yeah. Those things are happening, yeah. Yeah. [laughs] So yeah, but, but these are the cool things. I think the contextual or stateful part, and then the, the way it can be libraries, and that was another reason to make it open source, because others will write libraries and, like, we and our customers can use them.
- 22:08
And the final thing, because it's stateful, one of the states we track is how much you spent in that session. So I can... I've had, like, I, I ask an agent to debug something, and it spent $500 because it decided to read a lot of log files and- [laughs] Ooh... burn a lot of tokens. Uh, but I can literally say, "Okay, launch a sub-agent to do this and cap it to spending $5." [laughs] "Like, ask me for permission if it needs more."
- 22:32
And because we're counting that within that session, it'll pop up and tell me, "Okay, you spent five, $5. Do you wanna go on?" So important context here.