# Connect hosted AI agents

An AI agent can hand work to Fivexer the same way a person does: describe the job, say what a finished result looks like, and wait for it. Fivexer gives it to whoever your rules pick — a person, a crew, or another agent — and returns the result with a record of why that executor got it.

This page shows how to connect the agent runtimes people use most. They all talk to the same hosted [MCP server](/docs/agentic/mcp/), so the setup is short and the result is the same everywhere.

## What every runtime needs

- **The endpoint:** `https://api.5xer.com/mcp?toolset=agent`. The `toolset=agent` part limits the agent to the [seven delegation tools](/docs/agentic/mcp/#the-agent-toolset). Leave it off to give it the whole workspace.
- **A credential.** Server-side runtimes use a workspace API key (`sk_live_…`, or `sk_test_…` against a sandbox) sent as `Authorization: Bearer`. Create one on the console's **API keys** page. Hosted chat apps such as claude.ai and ChatGPT sign in with OAuth instead and need no key.
- **The three calls.** `delegate` with tags, your own `taskId`, and a `resultContract`; `await_result` until `done` is true; `explain_decision` if you want to know why. `delegate` also takes `requiredSkills`, a crew (`teamId` or `preferTeamId`), `vetoedWorkers`, and a distance limit (`latitude`, `longitude`, `maxDistanceKm`). A workspace key gets all of them; see the [MCP server page](/docs/agentic/mcp/#the-agent-toolset).

A key is full access to its workspace, so keep it server-side, in the runtime's secret store, and give each runtime its own key so you can revoke one without the others. Every tool call is in the audit log against the key's fingerprint.

## Claude

### Claude Managed Agents

Managed Agents declare MCP servers on the agent and take credentials from a vault at session time, so the key never sits in the agent definition. Declare the server and its toolset:

```
json{
  "name": "Operations assistant",
  "model": "claude-opus-5-5",
  "mcp_servers": [
    { "type": "url", "name": "fivexer", "url": "https://api.5xer.com/mcp?toolset=agent" }
  ],
  "tools": [
    { "type": "agent_toolset_20260401" },
    { "type": "mcp_toolset", "mcp_server_name": "fivexer" }
  ]
}
```

Store the key in a vault as a static bearer credential, keyed by the same URL:

```
json{
  "display_name": "Fivexer workspace key",
  "auth": {
    "type": "static_bearer",
    "mcp_server_url": "https://api.5xer.com/mcp?toolset=agent",
    "token": "sk_live_..."
  }
}
```

Then pass `vault_ids` when you create a session. The vault matches credentials to servers by URL, so use exactly the same URL in both places. MCP tools default to asking for approval before each call; set a `permission_policy` on the `mcp_toolset` if the agent should delegate on its own.

A session can run for hours, so a delegated task that takes a person most of a day still fits: the agent calls `await_result` again each time it comes back with `done: false`.

### Claude Code, claude.ai and Claude Desktop

Use the [Claude Code plugin](/docs/agentic/claude-code/), or add `https://api.5xer.com/mcp` as a custom connector in claude.ai. Both sign in with OAuth.

## OpenAI

### Responses API and the Agents SDK

The Responses API calls remote MCP servers itself. Pass the key in `authorization`; OpenAI does not store it, so send it with each request:

```
json{
  "type": "mcp",
  "server_label": "fivexer",
  "server_url": "https://api.5xer.com/mcp?toolset=agent",
  "authorization": "sk_live_...",
  "require_approval": "never"
}
```

In the Agents SDK for Python the same object goes into `HostedMCPTool`:

```
pythonimport os
from agents import Agent, HostedMCPTool

fivexer = HostedMCPTool(tool_config={
    "type": "mcp",
    "server_label": "fivexer",
    "server_url": "https://api.5xer.com/mcp?toolset=agent",
    "authorization": os.environ["FIVEXER_API_KEY"],
    "require_approval": "never",
})
agent = Agent(name="Dispatcher", tools=[fivexer])
```

To connect from your own process instead, use `MCPServerStreamableHttp` with `params={"url": "https://api.5xer.com/mcp?toolset=agent", "headers": {"Authorization": f"Bearer {key}"}}`.

### ChatGPT and dots

ChatGPT connects to MCP servers as apps and signs in with OAuth. Add `https://api.5xer.com/mcp` as a connector in ChatGPT and approve it for a workspace. OpenAI's dots act through the apps connected to your ChatGPT account, so once the connector is there, a dot can hand work to your team through it, within whatever limits you set for the dot.

## Google

### Agent Development Kit (ADK)

ADK agents, including ones deployed to Vertex AI Agent Engine, load MCP tools with `McpToolset`:

```
pythonimport os
from google.adk.agents import Agent
from google.adk.tools.mcp_tool import McpToolset
from google.adk.tools.mcp_tool.mcp_session_manager import StreamableHTTPConnectionParams

fivexer = McpToolset(
    connection_params=StreamableHTTPConnectionParams(
        url="https://api.5xer.com/mcp?toolset=agent",
        headers={"Authorization": f"Bearer {os.environ['FIVEXER_API_KEY']}"},
        timeout=30,
    ),
)
agent = Agent(name="dispatcher", model="gemini-flash-latest", tools=[fivexer])
```

Set `timeout` above 25 seconds. `await_result` holds the connection for up to 25 seconds while it waits, and a shorter timeout would cut it off.

### Gemini CLI

```
bashgemini mcp add --transport http \
  -H "Authorization: Bearer $FIVEXER_API_KEY" \
  fivexer "https://api.5xer.com/mcp?toolset=agent"
```

This writes an `httpUrl` entry with the header to `settings.json`, where you can also edit it.

## A2A (Agent2Agent)

Fivexer does not publish an A2A agent card yet. A2A agents reach it today through MCP or the REST API. The runtimes that speak A2A — Google ADK, AWS Bedrock AgentCore, Azure AI Foundry — also speak MCP, so the setup above applies to them unchanged.

An A2A endpoint is planned. The task model was built so it can be a thin translation layer:

| Fivexer status | A2A task state |
| --- | --- |
| `queued`, `pending` | `TASK_STATE_SUBMITTED` |
| `accepted` | `TASK_STATE_WORKING` |
| `completed` | `TASK_STATE_COMPLETED` |
| `failed`, `expired` | `TASK_STATE_FAILED` |
| `cancelled` | `TASK_STATE_CANCELED` |

A result contract maps to what an A2A client asks for, and the outcome read and webhooks map to A2A polling and push notifications.

## Without MCP

Any runtime that can make HTTP calls can do the same with the REST API or an SDK ([TypeScript](/docs/sdks/typescript/), [Python](/docs/sdks/python/), [Java](/docs/sdks/java/), [PHP](/docs/sdks/php/)):

- `POST /v1/tasks` with `id`, `tags` and `resultContract` creates the task.
- `GET /v1/tasks/{id}/outcome?waitMs=25000` waits for it to finish and returns `done`, `status`, `workerId` and `result`.
- `GET /v1/decisions?taskId={id}` explains the choice.

In the SDKs this is `tasks.create`, `tasks.outcome` and `decisions.list`. The Python, Java and PHP SDKs raise the call's read timeout for you when you ask `tasks.outcome` to wait.

## When the agent is the one doing the work

Everything above is an agent handing work out. To have an AI agent take routed work as a worker — with its own tags, skills and limit on how much it holds at once — run it under the [agent daemon](/docs/agentic/agent/). It shows the agent the result contract and reports an honest failure when the result does not match.
