Connect an agent environment
connect_agent_environmentConnect a hosted agent platform's self-hosted environment to a project, so that platform's agent sessions run their tools (shell, files, code) inside the project's folder on this server instead of in the platform's own sandbox. The platforms are Anthropic's Managed Agents (provider anthropic) and OpenAI's Agents API (provider openai). The owner creates the environment and its environment key in the platform's console, and can connect it on the project's page in the dashboard instead. An account API key is refused. anthropic needs environment_id as well: sessions are then picked up on their own, and the server sleeps between them. openai needs only the key: each session brings its own environment, which you start with agent_session. The key is stored encrypted and no tool returns it. Connecting again for the same provider replaces the key.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"project_id": "<project_id>",
"provider": "<provider>",
"key": "<key>"
},
"name": "connect_agent_environment"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | The environment key. Write-only: no tool ever returns it. | |
| provider | Yes | The agent platform: anthropic (Managed Agents) or openai (Agents API). | |
| project_id | Yes | The project's id, as returned by create_project or list_projects. | |
| environment_id | No | anthropic only: the self-hosted environment's id, as its console shows it. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| replaced | Yes | true when it replaced a key already connected for this provider. | |
| environment | Yes |