Page history
quickstart
managed-agents/quickstart
History
managed-agents/quickstart Changed · +2 / -2 lines
from line 37
For Linux environments, download the release binary directly. ```bash - VERSION=1.26.1 + VERSION=1.27.0 OS=$(uname -s | tr '[:upper:]' '[:lower:]') case $(uname -m) in x86_64) ARCH=amd64 ;;
from line 88
<Tab title="Java"> ```groovy Gradle - implementation("com.anthropic:anthropic-java:2.57.0") + implementation("com.anthropic:anthropic-java:2.58.0") ``` </Tab>
managed-agents/quickstart Changed · +37 / -20 lines
from line 37
For Linux environments, download the release binary directly. ```bash - VERSION=1.22.1 + VERSION=1.26.1 OS=$(uname -s | tr '[:upper:]' '[:lower:]') case $(uname -m) in x86_64) ARCH=amd64 ;;
from line 88
<Tab title="Java"> ```groovy Gradle - implementation("com.anthropic:anthropic-java:2.53.0") + implementation("com.anthropic:anthropic-java:2.57.0") ``` </Tab>
from line 161
echo "Agent ID: $AGENT_ID, version: $AGENT_VERSION" ``` - ```bash CLI - AGENT_ID=$(ant beta:agents create \ - --name "Coding Assistant" \ - --model '{id: claude-opus-5}' \ - --system "You are a helpful coding assistant. Write clean, well-documented code." \ - --tool '{type: agent_toolset_20260401}' \ - --transform id --raw-output) + <MultiFileExample language="cli" label="CLI"> + ```bash CLI + AGENT_ID=$(ant beta:agents create --transform id --raw-output < coding-assistant.agent.yaml) - echo "Agent ID: $AGENT_ID" - ``` + echo "Agent ID: $AGENT_ID" + ``` + <File filename="coding-assistant.agent.yaml"> + ```yaml + name: Coding Assistant + model: + id: claude-opus-5 + system: You are a helpful coding assistant. Write clean, well-documented code. + tools: + - type: agent_toolset_20260401 + ``` + </File> + </MultiFileExample> + ```python Python from anthropic import Anthropic
from line 366
echo "Environment ID: $ENVIRONMENT_ID" ``` - ```bash CLI - ENVIRONMENT_ID=$(ant beta:environments create \ - --name "quickstart-env" \ - --config '{type: cloud, networking: {type: unrestricted}}' \ - --transform id --raw-output) + <MultiFileExample language="cli" label="CLI"> + ```bash CLI + ENVIRONMENT_ID=$(ant beta:environments create --transform id --raw-output < quickstart.environment.yaml) - echo "Environment ID: $ENVIRONMENT_ID" - ``` + echo "Environment ID: $ENVIRONMENT_ID" + ``` + + <File filename="quickstart.environment.yaml"> + ```yaml + name: quickstart-env + config: + type: cloud + networking: + type: unrestricted + ``` + </File> + </MultiFileExample> ```python Python environment = client.beta.environments.create(
managed-agents/quickstart First recorded · 891 lines, first recorded
## Core concepts ## Prerequisites ## Install the CLI ## Install the SDK ## Create your first session ## What's happening ## Build a complete app ## Next steps
The first capture of this source. The page was already there, and this is what it said.
---
title: Get started with Claude Managed Agents
url: https://platform.claude.com/docs/en/managed-agents/quickstart
description: Create your first autonomous agent.
---
This guide walks you through creating an agent, setting up an environment, starting a session, and streaming agent responses.
<Tip>
**Prefer an interactive walkthrough?** Run `/claude-api managed-agents-onboard` in the latest version of [Claude Code](https://claude.com/product/claude-code) for a guided setup and interactive question-answering.
</Tip>
## Core concepts
| Concept | Description |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| **Agent** | The model, system prompt, tools, MCP servers, and skills |
| **Environment** | Configuration for where sessions run: an Anthropic-managed cloud sandbox, or a self-hosted sandbox on your own infrastructure |
| **Session** | A running agent instance within an environment, performing a specific task and generating outputs |
| **Events** | Messages exchanged between your application and the agent (user turns, tool results, status updates) |
## Prerequisites
* A [Claude Console account](https://platform.claude.com)
* An [API key](https://platform.claude.com/settings/keys)
## Install the CLI
<Tabs>
<Tab title="Homebrew (macOS)">
```bash
brew install anthropics/tap/ant
```
</Tab>
<Tab title="curl (Linux/WSL)">
For Linux environments, download the release binary directly.
```bash
VERSION=1.22.1
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
case $(uname -m) in
x86_64) ARCH=amd64 ;;
aarch64) ARCH=arm64 ;;
esac
curl -fsSL "https://github.com/anthropics/anthropic-cli/releases/download/v${VERSION}/ant_${VERSION}_${OS}_${ARCH}.tar.gz" \
| sudo tar -xz -C /usr/local/bin ant
```
You can find all releases on the [GitHub releases page](https://github.com/anthropics/anthropic-cli/releases).
</Tab>
<Tab title="Go">
You can also install the CLI from source using `go install`. Requires Go 1.25 or later.
```bash
go install github.com/anthropics/anthropic-cli/cmd/ant@latest
```
The binary is placed in `$(go env GOPATH)/bin`. Add it to your `PATH` if it isn't already:
```bash
export PATH="$PATH:$(go env GOPATH)/bin"
```
</Tab>
</Tabs>
Check the installation:
```bash
ant --version
```
## Install the SDK
<Tabs>
<Tab title="Python">
```bash
pip install anthropic
```
</Tab>
<Tab title="TypeScript">
```bash
npm install @anthropic-ai/sdk
```
</Tab>
<Tab title="Java">
```groovy Gradle
implementation("com.anthropic:anthropic-java:2.53.0")
```
</Tab>
<Tab title="Go">
```bash
go get github.com/anthropics/anthropic-sdk-go
```
</Tab>
<Tab title="C#">
```bash
dotnet add package Anthropic
```
</Tab>
<Tab title="Ruby">
```bash
bundle add anthropic
```
</Tab>
<Tab title="PHP">
```bash
composer require "anthropic-ai/sdk" "guzzlehttp/guzzle:^7"
```
</Tab>
</Tabs>
Set your API key as an environment variable:
```bash
export ANTHROPIC_API_KEY="your-api-key-here"
```
## Create your first session
<Note>
Managed Agents API requests require the `managed-agents-2026-04-01` beta header, except memory store endpoints, which use `agent-memory-2026-07-22` instead. The SDK sets the correct beta header automatically. See [Beta headers](https://platform.claude.com/docs/en/api/beta-headers#endpoint-specific-headers).
</Note>
<Steps>
<Step title="Create an agent">
Create an agent that defines the model, system prompt, and available tools.
<CodeGroup defaultLanguage="CLI">
```bash cURL
set -euo pipefail
agent=$(
curl -sS --fail-with-body https://api.anthropic.com/v1/agents \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "anthropic-beta: managed-agents-2026-04-01" \
-H "content-type: application/json" \
-d @- <<'EOF'
{
"name": "Coding Assistant",
"model": "claude-opus-5",
"system": "You are a helpful coding assistant. Write clean, well-documented code.",
"tools": [
{"type": "agent_toolset_20260401"}
]
}
EOF
)
AGENT_ID=$(jq -er '.id' <<<"$agent")
AGENT_VERSION=$(jq -er '.version' <<<"$agent")
echo "Agent ID: $AGENT_ID, version: $AGENT_VERSION"
```
```bash CLI
AGENT_ID=$(ant beta:agents create \
--name "Coding Assistant" \
--model '{id: claude-opus-5}' \
--system "You are a helpful coding assistant. Write clean, well-documented code." \
--tool '{type: agent_toolset_20260401}' \
--transform id --raw-output)
echo "Agent ID: $AGENT_ID"
```
```python Python
from anthropic import Anthropic
client = Anthropic()
agent = client.beta.agents.create(
name="Coding Assistant",
model="claude-opus-5",
system="You are a helpful coding assistant. Write clean, well-documented code.",
tools=[
{"type": "agent_toolset_20260401"},
],
)
print(f"Agent ID: {agent.id}, version: {agent.version}")
```
```typescript TypeScript
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic();
const agent = await client.beta.agents.create({
name: "Coding Assistant",
model: "claude-opus-5",
system: "You are a helpful coding assistant. Write clean, well-documented code.",
tools: [
{ type: "agent_toolset_20260401" },
],
});
console.log(`Agent ID: ${agent.id}, version: ${agent.version}`);
```
```csharp C#
using Anthropic;
using Anthropic.Models.Beta.Agents;
using Anthropic.Models.Beta.Environments;
using Anthropic.Models.Beta.Sessions;
using Anthropic.Models.Beta.Sessions.Events;
var client = new AnthropicClient();
var agent = await client.Beta.Agents.Create(new()
{
Name = "Coding Assistant",
Model = BetaManagedAgentsModel.ClaudeOpus5,
System = "You are a helpful coding assistant. Write clean, well-documented code.",
Tools =
[
new BetaManagedAgentsAgentToolset20260401Params
{
Type = "agent_toolset_20260401",
},
],
});
Console.WriteLine($"Agent ID: {agent.ID}, version: {agent.Version}");
```
```go Go
package main
import (
"context"
"fmt"
"github.com/anthropics/anthropic-sdk-go"
)
func main() {
client := anthropic.NewClient()
ctx := context.Background()
agent, err := client.Beta.Agents.New(ctx, anthropic.BetaAgentNewParams{
Name: "Coding Assistant",
Model: anthropic.BetaManagedAgentsModelConfigParams{
ID: anthropic.BetaManagedAgentsModelClaudeOpus5,
},
System: anthropic.String("You are a helpful coding assistant. Write clean, well-documented code."),
Tools: []anthropic.BetaAgentNewParamsToolUnion{{
OfAgentToolset20260401: &anthropic.BetaManagedAgentsAgentToolset20260401Params{
Type: anthropic.BetaManagedAgentsAgentToolset20260401ParamsTypeAgentToolset20260401,
},
}},
})
if err != nil {
panic(err)
}
fmt.Printf("Agent ID: %s, version: %d\n", agent.ID, agent.Version)
```
```java Java
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.beta.agents.AgentCreateParams;
import com.anthropic.models.beta.agents.BetaManagedAgentsAgentToolset20260401Params;
import com.anthropic.models.beta.agents.BetaManagedAgentsModel;
import com.anthropic.models.beta.environments.BetaCloudConfigParams;
import com.anthropic.models.beta.environments.BetaUnrestrictedNetwork;
import com.anthropic.models.beta.environments.EnvironmentCreateParams;
import com.anthropic.models.beta.sessions.SessionCreateParams;
import com.anthropic.models.beta.sessions.events.BetaManagedAgentsStreamSessionEvents;
import com.anthropic.models.beta.sessions.events.BetaManagedAgentsUserMessageEventParams;
import com.anthropic.models.beta.sessions.events.EventSendParams;
void main() {
var client = AnthropicOkHttpClient.fromEnv();
var agent = client.beta().agents().create(AgentCreateParams.builder()
.name("Coding Assistant")
.model(BetaManagedAgentsModel.CLAUDE_OPUS_5)
.system("You are a helpful coding assistant. Write clean, well-documented code.")
.addTool(BetaManagedAgentsAgentToolset20260401Params.builder()
.type(BetaManagedAgentsAgentToolset20260401Params.Type.AGENT_TOOLSET_20260401)
.build())
.build());
IO.println("Agent ID: " + agent.id() + ", version: " + agent.version());
```
```php PHP
use Anthropic\Client;
$client = new Client();
Cut at 300 lines.