Pular para o conteúdo principal

kobana finance ai-agents

Comandos de kobana finance ai-agents. Toda opção global (Opções globais) vale aqui.

ComandoHTTPDescrição
ai-agents triggersGET /v1/ai-agents/{id}/triggersListar os acionadores de um agente de IA
ai-agents triggers createPOST /v1/ai-agents/{id}/triggersAdicionar acionador a um agente de IA
ai-agents triggers updatePATCH /v1/ai-agents/{id}/triggers/{triggerId}Atualizar acionador de um agente de IA
ai-agents triggers deleteDELETE /v1/ai-agents/{id}/triggers/{triggerId}Remover acionador de um agente de IA
ai-agents triggers tokenPOST /v1/ai-agents/{id}/triggers/{triggerId}/tokenTrocar o token de um acionador de API
ai-agents listGET /v1/ai-agentsListar agentes de IA
ai-agents createPOST /v1/ai-agentsCriar agente de IA
ai-agents getGET /v1/ai-agents/{id}Obter agente de IA por ID
ai-agents updatePATCH /v1/ai-agents/{id}Atualizar agente de IA
ai-agents deleteDELETE /v1/ai-agents/{id}Excluir agente de IA

ai-agents triggers​

Listar os acionadores de um agente de IA

kobana finance ai-agents triggers [ID] [OPÇÕES] [COMANDO]

GET /v1/ai-agents/{id}/triggers

What runs the agent: manual, event, api and schedule triggers, oldest first. Not paginated. An api trigger shows its endpoint and the last characters of its token, never the token. Requires scope finance/ai_agents with access level read.

Argumentos do caminho: id

Parâmetros de consulta

NomeTipoObrigatórioDescrição
fieldsstringnãoComma-separated top-level fields to return, e.g. fields=description,amount,due_date. Omit for every field. id is always included; naming an object field returns it whole. An unknown name is a 400 whose details lists unknown and available.

Cabeçalhos

NomeTipoObrigatórioDescrição
X-Workspace-IdstringsimWorkspace to act on, as a UUID. The token identifies the organization; this header picks which of its workspaces the request reads or writes. It is checked against the token's organization, so a workspace owned by anyone else answers UNKNOWN_WORKSPACE — the same code as one that does not exist. Omitting it answers WORKSPACE_REQUIRED (400).

Respostas

HTTPDescrição
200The agent's triggers.
400Unknown name in fields.
404AI agent (or trigger) not found among the token person's agents in the workspace.

ai-agents triggers create​

Adicionar acionador a um agente de IA

kobana finance ai-agents triggers create [ID] [OPÇÕES]

POST /v1/ai-agents/{id}/triggers

manual (at most one), event with event_type (one per event), api (answers the endpoint's token — the ONLY time it is returned; store it) or schedule with cron and optional timezone. Requires scope finance/ai_agents with access level write. Takes no X-Idempotency-Key: the response may carry a token, and a recorded response would keep it.

Argumentos do caminho: id

Cabeçalhos

NomeTipoObrigatórioDescrição
X-Workspace-IdstringsimWorkspace to act on, as a UUID. The token identifies the organization; this header picks which of its workspaces the request reads or writes. It is checked against the token's organization, so a workspace owned by anyone else answers UNKNOWN_WORKSPACE — the same code as one that does not exist. Omitting it answers WORKSPACE_REQUIRED (400).

Corpo da requisição

NomeTipoObrigatórioDescrição
kindstringsimmanual enables starting the agent by hand (the dashboard's "Run now"); event runs it when a system event happens in the workspace (event_type); api exposes an endpoint with its own token; schedule runs it on a cron. Event and API triggers queue at most 20 runs per hour per agent; an agent has at most 20 triggers. Valores: manual, event, api, schedule.
event_typestringnãoRequired for event; not allowed for other kinds. Valores: receipt.saved, fiscal_document.received, payable.created, receivable.created.
cronstringnãoRequired for schedule: 5-field cron, at most every 15 minutes (422, reason: too_frequent).
timezonestringnãoschedule only. IANA time zone; defaults to America/Sao_Paulo.

Outros campos e objetos aninhados: kobana schema finance.ai-agents.triggers.create.

Respostas

HTTPDescrição
201Trigger created. token is set only for api. The Location header points at the new trigger.
400Malformed JSON body.
404AI agent (or trigger) not found among the token person's agents in the workspace.
409details.reason is duplicate_manual, duplicate_api, duplicate_event or too_many_triggers.
422Schema validation failure; a field missing or not allowed for the kind (details.reason missing_field / field_not_allowed, details.field); or an invalid schedule (invalid_cron, invalid_timezone, too_frequent).

ai-agents triggers update​

Atualizar acionador de um agente de IA

kobana finance ai-agents triggers update [ID] [TRIGGERID] [OPÇÕES]

PATCH /v1/ai-agents/{id}/triggers/{triggerId}

Partial. active pauses or resumes the trigger; event_type applies to event triggers; cron and timezone to schedule triggers (the next run is recomputed from now). Requires scope finance/ai_agents with access level write.

Argumentos do caminho: id, triggerId

Cabeçalhos

NomeTipoObrigatórioDescrição
X-Workspace-IdstringsimWorkspace to act on, as a UUID. The token identifies the organization; this header picks which of its workspaces the request reads or writes. It is checked against the token's organization, so a workspace owned by anyone else answers UNKNOWN_WORKSPACE — the same code as one that does not exist. Omitting it answers WORKSPACE_REQUIRED (400).

Corpo da requisição

NomeTipoObrigatórioDescrição
activebooleannãoPause (false) or resume (true) this trigger.
event_typestringnãoevent triggers only. Valores: receipt.saved, fiscal_document.received, payable.created, receivable.created.
cronstringnãoschedule triggers only.
timezonestringnãoschedule triggers only.

Outros campos e objetos aninhados: kobana schema finance.ai-agents.triggers.update.

Respostas

HTTPDescrição
200Updated trigger.
400Malformed JSON body.
404AI agent (or trigger) not found among the token person's agents in the workspace.
409X-Idempotency-Key reuse with a different body, or duplicate_event (the agent already listens to it).
422Schema validation failure, a field that does not apply to the kind, or an invalid schedule (details.reason).

ai-agents triggers delete​

Remover acionador de um agente de IA

kobana finance ai-agents triggers delete [ID] [TRIGGERID] [OPÇÕES]

DELETE /v1/ai-agents/{id}/triggers/{triggerId}

Removes the trigger (and, for a schedule, its schedule). Runs it started stay in the assistant. Requires scope finance/ai_agents with access level delete.

Argumentos do caminho: id, triggerId

Cabeçalhos

NomeTipoObrigatórioDescrição
X-Workspace-IdstringsimWorkspace to act on, as a UUID. The token identifies the organization; this header picks which of its workspaces the request reads or writes. It is checked against the token's organization, so a workspace owned by anyone else answers UNKNOWN_WORKSPACE — the same code as one that does not exist. Omitting it answers WORKSPACE_REQUIRED (400).

Respostas

HTTPDescrição
200Trigger removed.
404AI agent (or trigger) not found among the token person's agents in the workspace.

ai-agents triggers token​

Trocar o token de um acionador de API

kobana finance ai-agents triggers token [ID] [TRIGGERID] [OPÇÕES]

POST /v1/ai-agents/{id}/triggers/{triggerId}/token

Issues a new token for an api trigger; the previous one stops working at once. The token is returned only in this response. Requires scope finance/ai_agents with access level write. Takes no X-Idempotency-Key, for the same reason as the create.

Argumentos do caminho: id, triggerId

Cabeçalhos

NomeTipoObrigatórioDescrição
X-Workspace-IdstringsimWorkspace to act on, as a UUID. The token identifies the organization; this header picks which of its workspaces the request reads or writes. It is checked against the token's organization, so a workspace owned by anyone else answers UNKNOWN_WORKSPACE — the same code as one that does not exist. Omitting it answers WORKSPACE_REQUIRED (400).

Respostas

HTTPDescrição
200The trigger and its new token.
404AI agent (or trigger) not found among the token person's agents in the workspace.
422The trigger is not an api trigger.

ai-agents list​

Listar agentes de IA

kobana finance ai-agents list [OPÇÕES]

GET /v1/ai-agents

Returns a cursor-paginated page of the AI agents that belong to the token's person in the workspace — never another member's. Requires scope finance/ai_agents with access level read. Each agent carries its triggers and its latest run; every run is a new assistant conversation (last_run.conversation_id).

Parâmetros de consulta

NomeTipoObrigatórioDescrição
activestringnãoFilter by the agent's pause flag. false returns the paused agents; omit to return both. Valores: true, false.
sort_bystringnãoField to order by. Default: sort_by=created_at&sort_order=asc. Valores: created_at, title.
sort_orderstringnãoOrder direction. Defaults to asc; ignored without sort_by. Valores: asc, desc.
limitintegernãoPage size. Default 25, max 100.
cursorstringnãoOpaque cursor for the next page. Round-trip meta.next_cursor from the previous response.
fieldsstringnãoComma-separated top-level fields to return, e.g. fields=description,amount,due_date. Omit for every field. id is always included; naming an object field returns it whole. An unknown name is a 400 whose details lists unknown and available.

Cabeçalhos

NomeTipoObrigatórioDescrição
X-Workspace-IdstringsimWorkspace to act on, as a UUID. The token identifies the organization; this header picks which of its workspaces the request reads or writes. It is checked against the token's organization, so a workspace owned by anyone else answers UNKNOWN_WORKSPACE — the same code as one that does not exist. Omitting it answers WORKSPACE_REQUIRED (400).

Respostas

HTTPDescrição
200Page of AI agents plus pagination metadata.
400Malformed query (unknown filter / operator, invalid limit, bad cursor).

ai-agents create​

Criar agente de IA

kobana finance ai-agents create [OPÇÕES]

POST /v1/ai-agents

Creates an AI agent owned by the token's person: instructions the assistant runs with that person's permissions. It is born active with a manual trigger; add schedule, event or API triggers through POST /ai-agents/{id}/triggers. Every run spends AI credit and becomes a new assistant conversation; a destructive action waits for the person's confirmation in the assistant. Requires scope finance/ai_agents with access level write. Pass an X-Idempotency-Key header on retries.

Cabeçalhos

NomeTipoObrigatórioDescrição
X-Workspace-IdstringsimWorkspace to act on, as a UUID. The token identifies the organization; this header picks which of its workspaces the request reads or writes. It is checked against the token's organization, so a workspace owned by anyone else answers UNKNOWN_WORKSPACE — the same code as one that does not exist. Omitting it answers WORKSPACE_REQUIRED (400).

Corpo da requisição

NomeTipoObrigatórioDescrição
titlestringsim
instructionsstringsimThe prompt the assistant executes on every run.
summarystringnãoShort description shown on the agent's card.

Outros campos e objetos aninhados: kobana schema finance.ai-agents.create.

Respostas

HTTPDescrição
201Agent created. The Location header points at the new row.
400Malformed JSON body.
409X-Idempotency-Key reuse with a different body.
422Schema validation failure.

ai-agents get​

Obter agente de IA por ID

kobana finance ai-agents get [ID] [OPÇÕES]

GET /v1/ai-agents/{id}

Returns the same shape as the rows from the list endpoint. Requires scope finance/ai_agents with access level read. 404 covers both "doesn't exist" and "not in the tenant" — the API does not distinguish.

Argumentos do caminho: id

Parâmetros de consulta

NomeTipoObrigatórioDescrição
fieldsstringnãoComma-separated top-level fields to return, e.g. fields=description,amount,due_date. Omit for every field. id is always included; naming an object field returns it whole. An unknown name is a 400 whose details lists unknown and available.

Cabeçalhos

NomeTipoObrigatórioDescrição
X-Workspace-IdstringsimWorkspace to act on, as a UUID. The token identifies the organization; this header picks which of its workspaces the request reads or writes. It is checked against the token's organization, so a workspace owned by anyone else answers UNKNOWN_WORKSPACE — the same code as one that does not exist. Omitting it answers WORKSPACE_REQUIRED (400).

Respostas

HTTPDescrição
200Get an AI agent by id
404AI agent not found among the token person's agents in the workspace.

ai-agents update​

Atualizar agente de IA

kobana finance ai-agents update [ID] [OPÇÕES]

PATCH /v1/ai-agents/{id}

Partial update. active: false pauses every automatic trigger (schedule, event, API) and active: true resumes them, recomputing the next scheduled run from now. Triggers are managed under /ai-agents/{id}/triggers. Requires scope finance/ai_agents with access level write.

Argumentos do caminho: id

Cabeçalhos

NomeTipoObrigatórioDescrição
X-Workspace-IdstringsimWorkspace to act on, as a UUID. The token identifies the organization; this header picks which of its workspaces the request reads or writes. It is checked against the token's organization, so a workspace owned by anyone else answers UNKNOWN_WORKSPACE — the same code as one that does not exist. Omitting it answers WORKSPACE_REQUIRED (400).

Corpo da requisição

NomeTipoObrigatórioDescrição
titlestringnão
summarystringnão
instructionsstringnão
activebooleannãofalse pauses every automatic trigger (schedule, event, API); true resumes them.

Outros campos e objetos aninhados: kobana schema finance.ai-agents.update.

Respostas

HTTPDescrição
200Updated agent.
400Malformed JSON body.
404AI agent not found among the token person's agents in the workspace.
409X-Idempotency-Key reuse with a different body.
422Schema validation failure.

ai-agents delete​

Excluir agente de IA

kobana finance ai-agents delete [ID] [OPÇÕES]

DELETE /v1/ai-agents/{id}

Removes the agent, its triggers and their schedules. Its past runs stay in the assistant as conversations. Requires scope finance/ai_agents with access level delete. Calling DELETE twice returns 200 then 404.

Argumentos do caminho: id

Cabeçalhos

NomeTipoObrigatórioDescrição
X-Workspace-IdstringsimWorkspace to act on, as a UUID. The token identifies the organization; this header picks which of its workspaces the request reads or writes. It is checked against the token's organization, so a workspace owned by anyone else answers UNKNOWN_WORKSPACE — the same code as one that does not exist. Omitting it answers WORKSPACE_REQUIRED (400).

Respostas

HTTPDescrição
200AI agent deleted.
404AI agent not found among the token person's agents in the workspace.