Run your first agent
This example uses managed execution and the project default model.
Before you start
- Python 3.10 or later and uv.
- A Sikaru project ID.
- A project API key with
managed_agents:write,runs:create,runs:read, andevents:read. - Agent provisioning and managed execution enabled for your project.
Set up credentials with Authentication.
The commands below make hosted requests and can consume your project’s usage allowance.
Steps
Create the agent
Save this as first_agent.py. The definition holds the agent’s instructions; its digest identifies that exact content. Creation returns the managed agent and its release.
Run creation once. If support-quickstart already exists, find it with client.managed_agents.list_managed_agents(project) and reuse it, or pick another slug. Do not repeat creation after an uncertain response.
Submit a task
Append this to the same file:
The response confirms admission, not completion. Keep the run ID.
If the request times out before a response, retry with the same request_id and identical input. A new ID means new work.
tenant_id and user_id identify the caller in your application. The demo values are fine here; in an application, derive them from your authenticated user.
Watch the result
Append this bounded polling loop, then run uv run first_agent.py:
A successful run emits a run.completed event with the output, and the final status is completed. The answer should name the duplicate-charge report, the missing transaction IDs, and a next step based on those facts. Wording varies by model.
The two-minute deadline only bounds polling; each HTTP request also has its own timeout. It does not cancel hosted work. A waiting action needs handling; see Runs and tool requests.
Do not log event payloads indiscriminately in production. They can contain customer data.
Inspect what happened
Use the same run ID to read retained execution evidence:
A trajectory is a permitted view of the retained execution structure. It is separate from the final answer and may be partial or unavailable. See Trace ingestion for missing measurements and dashboard navigation.
Using TypeScript
Install the TypeScript SDK with npm install @sikaru/sdk, then start work with an existing active agent:
