Agent orchestration in production
  1. Tools
  2. Memory
  3. State
Refik Anadol Studio
mertcobanov@gmail.com
01 / 22</> press C

Agent Orchestration
in Production

Tools, Memory and State
Mert Cobanov
Senior AI Engineer, Refik Anadol Studio
DevFest Bursa '26
Hi, I'm Mert
  • Senior AI Engineer at Refik Anadol Studio
  • Building the AI agent for Dataland, a museum of AI arts in Los Angeles
  • Before agents: diffusion models, LoRA training, generative art
  • Before that: computer vision for manufacturing QC at Bosch
  • I write interactive explainers at cobanov.dev

Dataland

The world's first Museum of AI Arts, in Downtown Los Angeles. Visitors talk to a museum agent: artworks, the building, planning a visit.

FastAPIPydantic AIQdrantRedisPostgreSQL
tools memory state
What do we leave to the model, and what stays in code?
Everything in this talk is an answer to this question.

An agent is a loop

The model picks the next move. The loop around it is ours: what may run, when to stop, what to keep.

model decides code decides

Where it breaks

  1. ToolsLoops that never endSame tool, same arguments, until the timeout.
  2. ToolsConfident calls to the wrong toolOr the right tool with made-up arguments.
  3. MemoryContext that grows until it forgetsThe important fact was forty messages ago.
  4. StateState that lives in one processDeploy, restart, double tap: gone.

Draw the line on purpose

Two questions for every decision: does it need language? What does a wrong answer cost?

The model proposes. Code disposes.

The model fills a typed proposal. Code checks it against reality and decides what actually happens. Rejections go back as instructions.

01Tools
The model's hands. Every tool is a prompt, an API and a blast radius at the same time. Design them for the model.
Scope them to the phase.
Budget them in code.

Tools are prompts

  • Few, coarse tools beat many thin ones
  • Names and docstrings are instructions
  • Return what the model needs to say next, not your table
  • Errors are instructions: say what to do instead

Not every tool, every turn

Every tool in the prompt is another wrong option and more tokens. Expose only what makes sense in the current phase.

Budgets live in code

Never ask the model to stop. Make it unable to continue.

  • Request, tool call and token limits
  • A wall-clock timeout per turn
  • Same call, same args: refuse it
  • A deterministic fallback answer
02Memory
The model is stateless. Memory is everything the system does to carry context forward. The longer version, with interactive demos, lives at memory.cobanov.dev.

Context is not a database

Trimming history keeps you under the token limit. It also deletes facts: silently, by age, not by importance.

Four kinds of memory

Working

This conversation, right now. Lives in the prompt.

"asked about ocean works two minutes ago"

Episodic

What happened, and when. Time-stamped events.

"visited Oct 3, spent 40 min on floor 2"

Semantic

What is true about them. Facts that can change.

"prefers Turkish, visits with a wheelchair user"

Procedural

How we do things here. Skills, playbooks, tool habits.

"accessibility question → step-free route first"

Read fast. Write carefully.

Recall is on the hot path, with a latency budget. Remembering happens after the reply, in a worker.

Updating is harder than remembering

The model proposes facts. Code decides what is stored, what is replaced, and what must never be written down.

03State
Memory is what we know about the visitor. State is where we are in the conversation, right now. Make it explicit.
Keep it out of the process.
Run one turn at a time.

Make the state explicit

The model can suggest the next phase. Code owns the transitions, and the phase decides which tools exist.

State lives outside the process

Any worker can serve any turn. Two turns of the same session never run at the same time.

Takeaways

  1. 01Let the model decide what needs language. Let code decide what needs guarantees.
  2. 02Tools are prompts. Design and scope them for the model.
  3. 03Memory is a write problem before it is a read problem.
  4. 04State lives outside the model, and outside the process.

Thank you!

Further reading
memory.cobanov.dev, how agent memory works
kvcache.cobanov.dev, KV cache and attention, interactively
snippet.py python
Chide code→steps move the highlight