How Palantir's Agent Engine Works
Palantir's answer to flaky AI agents: stop improvising, start queueing events like a bank ledger.
Transcript
In Palantir's Agent SDK, an agent isn't a chatbot that improvises. It's a state machine: it processes queued events in order, deterministically, and updates its state.
Deterministic? With a language model in the middle? That sounds like a contradiction.
That's the trick. The model is the stateless part. Palantir's own definition, from their Agentic Runtime blog in January, is that an agent is a stateful control loop that repeatedly invokes a stateless reasoning core and feeds results back until a termination condition.
So the model is more like a function you call, and all the memory lives outside it.
Right. And the outside bit is built from three primitives: context items, events, and effects. Everything else is arrangement.
Start me with context items. That's just... the stuff the agent knows?
Think of them as cards on a table. Each one holds a piece of state: a document, a result, a chunk of the conversation. The docs say an event handler can create, delete or reorder context items, and dispatch events to a context item to update its data.
Reorder. Huh. Why would the order of your notes matter?
Because that stack is what becomes the model's prompt. Order is meaning. Even the system prompt is a function of current state, evaluated on every model request, so updating state changes the next set of instructions.
Okay, so the agent can rewrite its own briefing mid-task. That feels like it could go badly.
Which is where events come in. Nothing happens by vibes. Something dispatches a typed event, it goes in a queue, and it's processed in order.
Who's allowed to dispatch one?
Three sources, per the docs. A human sending one manually. An external automation on a schedule. Or the agent itself, from one of its own effects.
And effects are the doing part? The actually-send-the-email part?
Effects are the asynchronous work that happens outside the handler. Call an API, run a long query. When it finishes, it dispatches another event back into the queue.
Ah. So the loop closes. The messy, slow, real-world stuff never touches the deterministic bit directly.
It only re-enters as an event. That separation is the whole design.
Honestly, my instinct is that this is over-engineering. Why not let the model just call the tool and carry on?
Because of what breaks at length. Long-horizon planning is where agents fail: a subtly wrong assumption at step three, and by step fifteen the agent is pursuing a coherent but incorrect goal. Compounding error.
And nobody notices, because it still sounds confident.
That's the sharpest critique out there. Kiran Garimella wrote about an agent summarising an article it clearly couldn't access. Confident, detailed, completely fabricated. The failure mode isn't a crash, it's "sounds right".
So you end up verifying everything, which kills the point of delegating.
He calls that the verification tax. And the deeper one: responsibility without control. You're accountable for what it did without visibility into how.
Which the state machine actually fixes? Because the sequence is written down?
That's the old lesson, and it long predates AI. The distributed bakery and state-machine work, and Schneider's nineteen ninety tutorial, both rest on the same idea: outputs are completely determined by the sequence of requests processed, independent of time.
Same inputs, same order, same result. Replayable.
The team at Memobank built a core banking system this way. Transactions that span weeks, states stored in a database, side effects only fired once the state change is fully committed.
So you can't send the money and then fail to record it.
Or record it and never send it. Both leave the system inconsistent. They made side effects declarative data on the transition for exactly that reason.
And Palantir's version of that?
Fallback effects with retry policies, constant or exponential backoff. Plus something odd: in their Kubernetes environment, Rubix, nodes can't live longer than forty-eight hours.
Deliberately killing your own machines. That's a choice.
It forces every orchestration to be designed for disruption. If your agent can't survive its node vanishing, you find out on Tuesday, not during an incident.
Okay, give me a scenario. I want to see if I've got this.
Say your agent needs to pull a supplier's delivery data, which takes four minutes, and then decide whether to reroute a shipment. Where does each piece go?
The pull is an effect, because it's slow and external. When it finishes it dispatches an event. The handler takes that event and... makes a new context item with the data?
And possibly reorders the stack so the fresh data sits where the model will weight it.
Then the model reads the new state and recommends. And if the node dies at minute three, the effect retries rather than the whole thing collapsing.
That's it working. Three pieces: context items hold state, events change it in a fixed order, effects do slow work and report back as events.
And the model is a guest, not the host.
The caveat being it's a guest you still have to check. Determinism in the plumbing doesn't make the text true.
Yeah. The queue can be perfect and the summary still made up.
Next time something agentic goes sideways on you, ask which of those three it failed at. Usually it's the effect, quietly.
Sources
Katy and Theo researched this episode from these sources.
- Agent SDK • Advanced customization • Palantir
- Deconstructing the Bakery to Build a Distributed State Machine – Communications of the ACM
- Medium
- What AI Agents Still Cannot Do - Kiran Garimella
- Implementing fault-tolerant services using the state machine approach: a tutorial
- Medium
- Autonomous Agents: What They Can (and Cannot) Do Today | Dr. Vinayaka Jyothi