The Harness

Coming soon

The 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")
SlotWhat it isLearn more
sandboxwhere the agent runs code, shell, and files. Defaults to NoSandbox() (no execution).Sandbox
toolsyour @agents.tool functions, @SandboxTools.tool handlers (coming soon)Tools
connectorsmention Connectors from StudioConnectors & MCP
mcpsMCP servers not registered in Studio ConnectorsConnectors & MCP
hooksyour agents.Hook subclasses: run code before a turn, around every tool call, and after the answerCustom hooks
skillsLocalSkillBundle and RegistrySkill objects: instruction blocks the agent loads on demandSkills

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.