- Studio
- Managed Agents
- Learn
- Run modes
Agent lifecycle
Agent lifecycle
agents serve and agents deploy create an agent on Mistral. agents chat, agents list and agents logs try and operate it. agents shutdown removes it.
Try the agent
agents chat talks to an agent from the terminal. Without a name, it runs the agent of the project you are in, in this process: nothing deployed, nothing registered.
agents chat # the project's agent, in this process
agents chat hello-agent # a deployed agent, by name
Output:
Talking to hello-agent (session 01a1a89e-c09f-7043-85a7-af2170ff112d). Ctrl+D or /exit to quit.
> What is the weather in Paris?
→ get_weather {"city": "Paris"}
← get_weather done
It's currently **18°C and sunny** in Paris! ☀️
The reply streams as the agent writes it, and each tool call is shown as it runs. When the agent sets permission_mode="ask", the chat asks before each call: answer y to allow it once, a to allow it for the rest of the session, or n to deny it. Ctrl+C interrupts the agent's turn and keeps the session open. Ctrl+D or /exit ends the chat.
To send one message and exit, for a script or a quick check, pass -m:
agents chat hello-agent -m "What is the weather in Paris?"
For an agent with client tools, use a session in your application: agents chat refuses a client tool call, and the turn continues without it.
List your agents
agents list shows your workspace's agents, how each one runs, and whether it is running:
NAME KIND STATUS
hello-agent deployed running
draft-agent served not observed
not observed means Mistral saw nothing running the agent: it is stopped, or its status could not be read.
Read the logs
agents logs prints the latest log lines of an agent that agents deploy runs. --follow keeps printing new ones:
agents logs hello-agent --follow
Output:
Instance created. Preparing to start... [platform]
2026/11/04 20:30:00 env: loaded /mnt/runtime-init/env.json (version 1, 22 env keys, 0 config files)
2026/11/04 20:30:00 env: exec ["agents" "run-worker"]
Instance is healthy [platform]
Lines that end in [platform] come from Mistral's platform as it starts the agent; the others are what the agent's container prints.
A served agent has no logs here: they are in the terminal that runs agents serve. To filter by level, print JSON or add timestamps, see agents logs.
Update a deployed agent
The agent's name is the stable handle, and it is unique per workspace. Each new commit or new configuration that you deploy under that name writes a new agent, with a new id, and retires the one that held the name:
You run | New agent id? | Open sessions |
|---|---|---|
| agents deploy of a new commit or configuration | yes | their next message runs on the new code |
| agents deploy of the same commit and configuration, with the same SDK release | no | unchanged |
| agents serve again with new code | yes | their next message runs on the new code |
| agents serve again, or a replica, with the same code | no | unchanged |
agents serve tells code apart by the code version: AGENTS_SDK_CODE_VERSION when you set it, for example to the commit your image is built from, else a hash of the project.
A turn that is running when you redeploy can fail, or stay Running until a session limit ends it; redeploy when no turn is running.
Shut an agent down
Shutdown releases the name and stops new sessions reaching the agent. What happens next depends on who hosts it:
agents deploy (Mistral-managed) | agents serve (self-hosted) | |
|---|---|---|
| Name released | ✓ | ✓ |
| New sessions | refused | refused |
| What runs the agent | deleted by Mistral | keeps running |
| Sessions already open | can no longer be driven | keep working |
| Coming back | agents deploy again | agents serve again |
Mistral deletes what it hosts. Your agents serve process is yours: Mistral cannot stop it, and it keeps waiting for sessions.
agents shutdown hello-agent
For a Mistral-managed agent (agents deploy), it prints:
Agent hello-agent is shut down. Sessions can no longer reach it.
Its managed deployment hello-agent was deleted.
Deploy again to bring the agent back, under a new agent id.
For a self-hosted agent (agents serve), it prints:
Agent hello-agent is shut down. Sessions can no longer reach it.
Its worker on agents-sdk-hello-agent is not managed here and may still be running.
If it is, stop that process yourself. Running `agents serve` again re-registers the name.
Shutdown cannot be undone
Coming back means deploying or serving again, which creates a new agent with a new id. The CLI confirms before it acts; pass --yes to skip the prompt in a script.
Sessions that are already open
Shutdown cancels nothing that is running.
On a self-hosted agent your agents serve process is still up, so an open session keeps answering until you stop the process.
On a Mistral-managed agent nothing runs it any more. Rather than accept work that can never run, Mistral refuses further messages on those sessions, and the SDK raises agents.SessionTerminatedError:
SessionTerminatedError: Agent session <id> cannot accept commands because agent 'hello-agent' was shut down and its deployment was deleted
Let open sessions finish before you shut a Mistral-managed agent down. Deploying the same name again makes those sessions reachable again, on the new code.
Freeing a name
Names are unique per workspace, so a serve that fails like this is usually blocked by an agent an earlier agents deploy created:
Cannot serve agent: registration failed at https://api.mistral.ai/v2/agents: the name hello-agent is already bound to another workflow or deployment
Shut that agent down, or serve under a free name with --name hello-agent-dev.
Next steps
- Self-hosted: agents serve and Mistral-managed: agents deploy: the two ways to deploy an agent.
- Session lifecycle and listing: end and list the sessions of an agent.