The Harness
Coming soonThe Harness defines everything the agent can use: the tools it can call, the sandbox it runs code in, the hooks that runs actions on defined events
from mistralai.agents import agents
harness = agents.Harness(
sandbox=agents.MistralSandbox(), # where Bash commands run
tools=[get_weather], # custom tools the agent can call
connectors=[ # tools discovered from Studio Connectors
agents.connector("deepwiki"),
],
mcps={ # MCP servers not registered in Studio Connectors
"github_copilot": agents.RemoteMCP(
url="https://api.githubcopilot.com/mcp/",
auth_header_env_vars={"Authorization": "GITHUB_MCP_TOKEN"},
)
}
)
agent = agents.Agent(model="mistral-medium-3-5", instructions="Ship it.", harness=harness)
result = await agent.run("ship it")| Slot | What it is | Learn more |
|---|---|---|
sandbox | where the agent runs code, shell, and files. Defaults to NoSandbox() (no execution). | Sandbox |
tools | your @agents.tool functions, @SandboxTools.tool handlers (coming soon) | Tools |
connectors | mention Connectors from Studio | Connectors & MCP |
mcps | MCP servers not registered in Studio Connectors | Connectors & MCP |
hooks | your agents.Hook subclasses: run code before a turn, around every tool call, and after the answer | Custom hooks |
skills | LocalSkillBundle and RegistrySkill objects: instruction blocks the agent loads on demand | Skills |
The same harness works local and on a worker - define it once, choose where to run later. See Run modes.
See also
See also
- Sandbox - the agent's code-execution environment.
- Tools - functions and sandbox tools the agent can call.
- Connectors & MCP - external systems over MCP.
- Custom hooks - the middleware primitive.
- Skills - instructions the agent loads on demand.
- Sessions - multi-turn runs over one harness.
- Run modes - the same harness, local then durable.