Creates a new agent. The agent persists until deleted. Sessions are created separately from this object — this endpoint only defines the agent’s configuration.Documentation Index
Fetch the complete documentation index at: https://docs.litellm-agent-platform.ai/llms.txt
Use this file to discover all available pages before exploring further.
Request
| Header | Value |
|---|---|
Authorization | Bearer <MASTER_KEY> |
Content-Type | application/json |
Body parameters
LiteLLM model string for the agent, e.g.
anthropic/claude-sonnet-4-6. Passed to the harness as LITELLM_DEFAULT_MODEL.Human-readable label shown in the web UI. Not required to be unique.
System prompt injected at the start of every session. May include
<!-- skill:<id> --> markers if skills are attached. Leave empty for a general-purpose agent.Container harness to run in the sandbox pod. One of:
API harnesses accept structured messages via
| Value | Type | Description |
|---|---|---|
opencode | API | opencode in server mode |
claude-agent-sdk | API | Anthropic Claude Agent SDK |
claude-code | TUI | Claude Code CLI with PTY |
codex | TUI | OpenAI Codex CLI with PTY |
POST /sessions/{id}/message. TUI harnesses expose a WebSocket PTY instead.pip
requirements.txt content. Packages are installed into the sandbox at harness boot. Stored as the AGENT_REQUIREMENTS env var internally.HTTPS URL of a Git repository to clone into the sandbox at session start, e.g.
https://github.com/org/repo. Must be a valid URL.Branch to check out from
repo_url.List of MCP server connection strings passed to the harness.
Allowed outbound domains for the sandbox network policy. An empty list means no domain-level allow rule is applied.
Blocked outbound domains for the sandbox network policy.
Agent-level environment variables persisted to the database and injected into every session container. Use for long-lived secrets such as
GITHUB_TOKEN or API keys the agent always needs.Per-session env_vars (set when creating a session) take precedence over agent-level values for the same key.Constraints:- Key names must match
^[A-Za-z_][A-Za-z0-9_]*$ - Maximum 50 keys
- Total JSON-encoded size must be ≤ 16 KB
- The following keys are reserved and cause a
400if used:REPO_URL,BRANCH,LITELLM_API_KEY,LITELLM_API_BASE,LITELLM_DEFAULT_MODEL,AGENT_PROMPT,PORT,GIT_TOKEN,AGENT_REQUIREMENTS
GIT_TOKEN is reserved because the harness entrypoint erases it after git clone so the agent can’t read it back. For tokens that need to survive into the agent shell (for gh pr create, git push, etc.), use GITHUB_TOKEN or GH_TOKEN instead.IDs of existing skills to attach to the agent at create time. Each skill’s content is appended to
prompt as a <!-- skill:<id> --> block. Unknown or unowned skill IDs return 404.Files injected into the sandbox container at session start. Maximum 20 files; total base64-encoded size must be ≤ 10 MB.Each entry has:
| Field | Type | Description |
|---|---|---|
name | string | Friendly display name |
sandbox_path | string | Absolute or home-relative path in the container, must start with / or ~ |
content | string | Base64-encoded file content |
content_type | string | MIME type, defaults to application/octet-stream |
size | number | File size in bytes |
Response
Returns the newly createdApiAgent object. See List agents for the full field reference.