API Quickstart¶
This quickstart deploys a simple agent via API and wires policy explicitly so tool calls are authorized from day one.
Base URL examples below use https://api.runagents.io.
Step 1: Set API Key¶
Step 2: Seed Starter Resources¶
curl -X POST "$API/api/starter-kit" \
-H "Authorization: Bearer $RUNAGENTS_API_KEY" \
-H "Content-Type: application/json"
Example response (201):
Step 3: Create A Simple Policy¶
curl -X POST "$API/api/policies" \
-H "Authorization: Bearer $RUNAGENTS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "hello-echo-policy",
"spec": {
"policies": [
{
"permission": "allow",
"resource": "http://governance.agent-system.svc:8092/*",
"operations": ["GET", "POST"]
}
]
}
}'
Step 4: Deploy Agent With Policy Binding¶
curl -X POST "$API/api/deploy" \
-H "Authorization: Bearer $RUNAGENTS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent_name": "hello-world",
"source_files": {
"agent.py": "def handler(request):\n return {\"response\": \"hello from runagents\"}"
},
"entry_point": "agent.py",
"required_tools": ["echo-tool"],
"llm_configs": [
{"provider": "openai", "model": "gpt-4o-mini", "role": "chat"}
],
"policies": ["hello-echo-policy"]
}'
Example response (201):
{
"agent": "hello-world",
"namespace": "default",
"tools_created": [],
"execution_mode": "INSTANT_RUNTIME",
"build_required": false
}
Step 5: Verify Deployment¶
Look for your agent transitioning to Running.
Step 6: Check Runs¶
Run states you will commonly see:
RUNNINGPAUSED_APPROVALCOMPLETEDFAILED
Step 7: Handle Approvals (If Triggered)¶
If a policy rule resolves to approval_required, approve via:
curl -s "$API/governance/requests?status=PENDING" \
-H "Authorization: Bearer $RUNAGENTS_API_KEY" | jq .
curl -X POST "$API/governance/requests/<request-id>/approve" \
-H "Authorization: Bearer $RUNAGENTS_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'