
Anthropic ManagedAgentSession
CertifiedRun a Claude Code session on Claude Managed Agents
Anthropic ManagedAgentSession
Run a Claude Code session on Claude Managed Agents
Creates an agent, starts a session in an Anthropic-managed cloud environment, sends the prompt, and follows the session events in the execution logs until the agent stops. Nothing has to be installed or hosted on the Kestra side. The task authenticates with an Anthropic API key only. Killing the execution interrupts the session. See the Managed Agents documentation.
type: io.kestra.plugin.anthropic.ManagedAgentSessionExamples
Fix a failing test in a repository, with a spending limit.
id: claude_code_session
namespace: company.team
tasks:
- id: session
type: io.kestra.plugin.anthropic.ManagedAgentSession
apiKey: "{{ secret('ANTHROPIC_API_KEY') }}"
model: claude-sonnet-5
systemPrompt: "You are a careful engineer. Make the smallest change that works."
prompt: "Investigate the flaky test in the CI logs, fix it, and open a pull request."
maxCostUsd: 5
repository:
url: https://github.com/acme/app
branch: main
token: "{{ secret('GITHUB_TOKEN') }}"
- id: report
type: io.kestra.plugin.core.log.Log
message: "{{ outputs.session.status }} ({{ outputs.session.costUsd }} USD): {{ outputs.session.message }}"
Installation
Our standard Docker images already include this plugin. If you use a -slim image or another setup, install it with the following command:
kestractl plugins get io.kestra.plugin:plugin-anthropic --compatible-for $KESTRA_VERSION For kestractl, use your Kestra version with --compatible-for, or specify an exact plugin version.
For Kestra CLI, replace LATEST with a specific version or version range to pin the plugin version.
Properties
apiKey *string
Anthropic API Key
model *string
Model
Claude model the agent runs on, for example claude-sonnet-5.
prompt *string
Prompt
The task the agent works through on its own.
allowedHosts array
Allowed hosts
Hosts the sandbox may reach when networking is LIMITED. MCP servers and package managers are allowed in that mode.
assets
Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.
io.kestra.core.models.assets.AssetsDeclaration
IGNOREFAILWARNAsset failure behavior
Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.
Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.
The assets consumed as inputs.
io.kestra.core.models.assets.AssetIdentifier
1The assets produced as outputs.
io.kestra.plugin.ee.assets.Dataset
1150{}1150io.kestra.plugin.ee.assets.File
1150{}1150io.kestra.plugin.ee.assets.Table
1150{}1150io.kestra.plugin.ee.assets.VM
1150{}1150io.kestra.core.models.assets.External
1150{}1150io.kestra.core.models.assets.Custom
11501Custom asset type
{}1150baseUrl string
Base URL
Optional Anthropic-compatible endpoint. Defaults to the SDK endpoint. Requests, including the API key, are sent to this host, so set it with forced: true in plugin defaults when the API key comes from there.
connectTimeout string
Connect timeout
Connection timeout as an ISO-8601 duration. Defaults to PT1M, and zero disables it.
environmentId string
Environment ID
Existing environment to run in. When empty, a cloud environment is created for the run with the network access set by networking, then archived afterwards.
maxCostUsd numberstring
Spending limit in USD
Must be greater than 0. The session pauses once its list cost reaches this amount, and the task then ends with status SPENDING_LIMIT_REACHED. No limit applies when unset.
maxRetries integerstring
2Maximum retries
SDK retries for transient errors, between 0 and 10. Defaults to 2, and 0 disables them.
mcpServers array
MCP servers
Remote MCP servers the agent can call.
io.kestra.plugin.anthropic.ManagedAgentSession-McpServer
Server name
Unique name of the MCP server within the agent.
Server URL
networking string
UNRESTRICTEDUNRESTRICTEDLIMITEDEnvironment networking
Network access of the environment created for the run, ignored when environmentId is set. UNRESTRICTED lets the sandbox reach any host. Because the sandbox holds the repository token and MCP credentials, prefer LIMITED with allowedHosts whenever the prompt or the repository content is not fully trusted.
readTimeout string
Read timeout
Maximum time for a response as an ISO-8601 duration, both between packets and for the whole call. Defaults to the SDK timeout (PT10M), and zero disables it.
repository
Git repository
Repository mounted in the session sandbox before the agent starts.
io.kestra.plugin.anthropic.ManagedAgentSession-GitRepository
Repository URL
Branch to check out
Access token
Token used to clone the repository and push changes.
skills array
Skills
Skills made available to the agent.
io.kestra.plugin.anthropic.ManagedAgentSession-Skill
Skill ID
ANTHROPICCUSTOMSkill type
ANTHROPIC for prebuilt skills, CUSTOM for skills uploaded to your organization.
systemPrompt string
System prompt
Optional system instructions for the agent.
Outputs
costUsd number
Cost in USD
List cost of the session, when reported by the API.
message string
Final message
Last message written by the agent.
sessionId string
Session ID
ID of the Managed Agents session, usable to inspect it in the Claude Console.
status string
FINISHEDSPENDING_LIMIT_REACHEDMAX_TURNS_REACHEDWAITING_FOR_INPUTFAILEDStatus
How the session ended.
Metrics
usage.cache.read.tokens counter
tokenCache read tokens used by the session.
usage.input.tokens counter
tokenInput tokens used by the session.
usage.output.tokens counter
tokenOutput tokens used by the session.