Skip to main content

AI agents

Instructions the assistant runs on its own, with the permissions of the person who owns the token — say, a daily digest of the payables that became overdue. The list returns only the token person's agents in the workspace, never another member's. Every run spends AI credit and becomes a new assistant conversation (last_run.conversation_id); a destructive action waits for the person's confirmation in the assistant.

CommandHTTPDescription
ai-agents listGET /v1/ai-agentsList AI agents
ai-agents createPOST /v1/ai-agentsCreate an AI agent
ai-agents getGET /v1/ai-agents/{id}Get an AI agent by id
ai-agents updatePATCH /v1/ai-agents/{id}Update an AI agent
ai-agents deleteDELETE /v1/ai-agents/{id}Delete an AI agent
ai-agents triggers getGET /v1/ai-agents/{id}/triggersList the triggers of an AI agent
ai-agents triggers createPOST /v1/ai-agents/{id}/triggersAdd a trigger to an AI agent
ai-agents triggers updatePATCH /v1/ai-agents/{id}/triggers/{triggerId}Update a trigger of an AI agent
ai-agents triggers deleteDELETE /v1/ai-agents/{id}/triggers/{triggerId}Remove a trigger from an AI agent
ai-agents triggers tokenPOST /v1/ai-agents/{id}/triggers/{triggerId}/tokenRotate the token of an API trigger

An agent is born active with a manual trigger; the others come in through triggers create: event (with event_type: receipt.saved, fiscal_document.received, payable.created or receivable.created), schedule (with a 5-field cron, at most every 15 minutes, and an optional timezone — default America/Sao_Paulo) and api. An api trigger's token only appears in the response of triggers create and triggers token — store it; triggers token invalidates the previous one at once. That is why those two routes take no --idempotency-key. update with active: false pauses every automatic trigger and active: true resumes them. Deleting the agent removes its triggers; past runs stay in the assistant. The scopes are finance/ai_agents (read, write and delete).

Examples​

--params carries query and path parameters (id, page, filters); --json carries the request body; --fields limits which fields come back — worth using on every list/get to save context. See Global flags for the full reference.

# List AI agents
kobana finance ai-agents list \
--params '{"active": true}' \
--fields "id,title,active,next_run_at,last_run"

# Get an AI agent by id
kobana finance ai-agents get \
--params '{"id": "AI_AGENT_ID"}'

# Create an AI agent
kobana finance ai-agents create \
--json '{"title": "Overdue payables digest", "instructions": "List the payables that became overdue yesterday, grouped by supplier, with the total."}'

# Pause every automatic trigger
kobana finance ai-agents update \
--params '{"id": "AI_AGENT_ID"}' \
--json '{"active": false}'

# List the triggers of an AI agent
kobana finance ai-agents triggers get \
--params '{"id": "AI_AGENT_ID"}'

# Schedule the agent on weekdays at 6am
kobana finance ai-agents triggers create \
--params '{"id": "AI_AGENT_ID"}' \
--json '{"kind": "schedule", "cron": "0 6 * * 1-5", "timezone": "America/Sao_Paulo"}'

# Update a trigger of an AI agent
kobana finance ai-agents triggers update \
--params '{"id": "AI_AGENT_ID", "triggerId": "TRIGGER_ID"}' \
--json '{"cron": "0 7 * * 1-5"}'

# Rotate the token of an API trigger
kobana finance ai-agents triggers token \
--params '{"id": "AI_AGENT_ID", "triggerId": "TRIGGER_ID"}'

# Remove a trigger from an AI agent
kobana finance ai-agents triggers delete \
--params '{"id": "AI_AGENT_ID", "triggerId": "TRIGGER_ID"}' \
--dry-run

# Delete an AI agent
kobana finance ai-agents delete \
--params '{"id": "AI_AGENT_ID"}' \
--dry-run

Next steps​