Pular para o conteúdo

Execute Agent

POST
/api/v1/ai/agents/instances/{instance_id}/execute

Execute agent instance with provided input data (sync or async)

This endpoint starts a new execution of the agent using the ReAct loop. The agent will:

  1. Analyze the input data
  2. Reason about what actions to take
  3. Execute tools/actions
  4. Observe results
  5. Repeat until task is complete or max iterations reached

Args: instance_id: ID of the agent instance input_data: Input data for the agent context_type: Optional context type (deal, contact, lead) context_id: Optional context ID async_execution: If True, execute in background (returns immediately)

instance_id
required
Instance Id
integer
context_type
Any of:
string
context_id
Any of:
integer
async_execution
Async Execution
boolean
x-tenant-id
Any of:
integer
Input Data
object

Successful Response

AgentExecutionResponse

Schema de resposta para AgentExecution

object
id
required
Id
integer
agent_id
required
Agent Id
integer
trigger_type
required
ExecutionTriggerEnum

Como a execução foi iniciada

string
Allowed values: manual scheduled event api
triggered_by
required
Any of:
integer
status
required
ExecutionStatusEnum

Status de uma execução

string
Allowed values: pending running completed failed cancelled timeout
input_data
required
Any of:
object
output_data
required
Any of:
object
error_message
required
Any of:
string
context_type
required
Any of:
string
context_id
required
Any of:
integer
started_at
required
Any of:
string format: date-time
completed_at
required
Any of:
string format: date-time
execution_time_ms
required
Any of:
integer
iteration_count
required
Iteration Count
integer
iterations
required
Iterations
Array<object>
IterationData

Schema para uma iteração do agente

object
iteration
required
Iteration
integer
thought
required
Thought
string
action
required
Action
string
action_input
required
Action Input
object
observation
required
Observation
string
timestamp
required
Timestamp
string
tools_used
required
Tools Used
Array<string>
total_tokens
required
Total Tokens
integer
total_cost
required
Total Cost
number
model_used
required
Any of:
string
success
required
Success
boolean
actions_taken
required
Actions Taken
integer
extra_metadata
required
Extra Metadata
object
created_at
required
Created At
string format: date-time
updated_at
required
Updated At
string format: date-time

Validation Error

HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string