Skip to main content
POST
/
agent
Create a new agent
curl --request POST \
  --url https://api.example.com/agent/ \
  --header 'Content-Type: application/json' \
  --header 'x-user-id: <x-user-id>' \
  --data @- <<EOF
{
  "name": "<string>",
  "system_prompt": "You're a helpful assistant.",
  "context_config": {
    "trigger_ratio": 0.8,
    "reserve_ratio": 0.1,
    "compression_prompt": "<system-hint>You have been working on the task described above but have not yet completed it. Now write a continuation summary that will allow you to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable.</system-hint>",
    "summary_template": "<system-info>Here is a summary of your previous work\n# Task Overview\n{task_overview}\n\n# Current State\n{current_state}\n\n# Important Discoveries\n{important_discoveries}\n\n# Next Steps\n{next_steps}\n\n# Context to Preserve\n{context_to_preserve}</system-info>",
    "summary_schema": {},
    "tool_result_limit": 3000
  },
  "react_config": {
    "max_iters": 20,
    "stop_on_reject": false
  }
}
EOF
{
  "agent_id": "<string>"
}

Documentation Index

Fetch the complete documentation index at: https://docs.agentscope.io/llms.txt

Use this file to discover all available pages before exploring further.

Headers

x-user-id
string
required

Caller's user ID. Temporary header-based identity; will be replaced by JWT auth.

Body

application/json

Request body for creating a new agent.

name
string
required

Display name of the agent.

system_prompt
string
default:You're a helpful assistant.

Base system prompt fed to the agent.

context_config
ContextConfig · object

Context-window management configuration.

react_config
ReActConfig · object

ReAct loop configuration.

Response

Successful Response

Response body after creating an agent.

agent_id
string
required

Server-assigned agent identifier.