1. Create an agent. Give it a name, instructions, and the permissions it needs.
Create an agent
curl "$PV_API_URL/agents" \
-H "Authorization: Bearer $PV_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "invoice-reconciler",
"instructions": "Match incoming invoices to purchase orders and flag mismatches.",
"model": "auto",
"permissions": ["integrations:accounting:read", "files:write"]
}'
2. Run a task. Send the agent a goal. The response includes the task ID.
Run a task
curl "$PV_API_URL/tasks" \
-H "Authorization: Bearer $PV_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "agt_123",
"input": "Reconcile all invoices received last week."
}'
3. Get the result. Poll the task, or stream its events as they happen (see Streaming results).
Check a task
curl "$PV_API_URL/tasks/tsk_456" \
-H "Authorization: Bearer $PV_API_KEY"