Agent Run Logs API
This endpoint is currently in ALPHA status and is subject to change. We welcome your feedback to help improve this API.
The Agent Run Logs API allows you to retrieve detailed execution logs for agent runs, providing insights into the agent’s thought process, tool usage, and execution flow.
Endpoint
Authentication
This endpoint requires API token authentication. Include your token in the Authorization header:
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
org_id | integer | Yes | Your organization ID |
agent_run_id | integer | Yes | The ID of the agent run to retrieve logs for |
skip | integer | No | Number of logs to skip for pagination (default: 0) |
limit | integer | No | Maximum number of logs to return (default: 100, max: 100) |
Response Structure
The endpoint returns an AgentRunWithLogsResponse
object containing the agent run details and paginated logs:
Agent Run Log Fields
Each log entry in the logs
array contains the following fields:
Core Fields
Field | Type | Description |
---|---|---|
agent_run_id | integer | The ID of the agent run this log belongs to |
created_at | string | ISO 8601 timestamp when the log entry was created |
message_type | string | The type of log entry (see Log Types below) |
Agent Reasoning Fields
Field | Type | Description |
---|---|---|
thought | string | null | The agent’s internal reasoning or thought process for this step |
Tool Execution Fields
Field | Type | Description |
---|---|---|
tool_name | string | null | Name of the tool being executed (e.g., “ripgrep_search”, “file_write”) |
tool_input | object | null | JSON object containing the parameters passed to the tool |
tool_output | object | null | JSON object containing the tool’s execution results |
observation | object | string | null | The agent’s observation of the tool execution results or other contextual data |
Log Types
The message_type
field indicates the type of log entry. Here are the possible values:
Plan Agent Types
Type | Description |
---|---|
ACTION | The agent is executing a tool or taking an action |
PLAN_EVALUATION | The agent is evaluating or updating its plan |
FINAL_ANSWER | The agent is providing its final response or conclusion |
ERROR | An error occurred during execution |
USER_MESSAGE | A message from the user (e.g., interruptions or additional context) |
USER_GITHUB_ISSUE_COMMENT | A comment from a GitHub issue that the agent is processing |
PR Agent Types
Type | Description |
---|---|
INITIAL_PR_GENERATION | The agent is generating the initial pull request |
DETECT_PR_ERRORS | The agent is detecting errors in a pull request |
FIX_PR_ERRORS | The agent is fixing errors found in a pull request |
PR_CREATION_FAILED | Pull request creation failed |
PR_EVALUATION | The agent is evaluating a pull request |
Commit Agent Types
Type | Description |
---|---|
COMMIT_EVALUATION | The agent is evaluating commits |
Link Types
Type | Description |
---|---|
AGENT_RUN_LINK | A link to another related agent run |
Field Population Patterns
Different log types populate different fields:
ACTION Logs
- Always have:
tool_name
,tool_input
,tool_output
- Often have:
thought
,observation
- Example: Tool executions like searching code, editing files, creating PRs
PLAN_EVALUATION Logs
- Always have:
thought
- May have:
observation
- Rarely have: Tool-related fields
- Example: Agent reasoning about next steps
ERROR Logs
- Always have:
observation
(containing error details) - May have:
tool_name
(if error occurred during tool execution) - Example: Failed tool executions or system errors
FINAL_ANSWER Logs
- Always have:
observation
(containing the final response) - May have:
thought
- Example: Agent’s final response to the user
Usage Examples
Basic Log Retrieval
Filtering by Log Type
Pagination Example
Debugging Failed Runs
Common Use Cases
1. Building Monitoring Dashboards
Use the logs to create dashboards showing:
- Agent execution progress
- Tool usage patterns
- Error rates and types
- Execution timelines
2. Debugging Agent Behavior
Analyze logs to understand:
- Why an agent made certain decisions
- Where errors occurred in the execution flow
- What tools were used and their results
3. Audit and Compliance
Track agent actions for:
- Code change auditing
- Compliance reporting
- Security monitoring
4. Performance Analysis
Monitor:
- Tool execution times
- Common failure patterns
- Agent reasoning efficiency
Rate Limits
- 60 requests per 60 seconds per API token
- Rate limits are shared across all API endpoints
Error Responses
Status Code | Description |
---|---|
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid or missing API token |
403 | Forbidden - Insufficient permissions |
404 | Not Found - Agent run not found |
429 | Too Many Requests - Rate limit exceeded |
Feedback and Support
Since this endpoint is in ALPHA, we’d love your feedback! Please reach out through:
The structure and fields of this API may change as we gather feedback and improve the service. We’ll provide advance notice of any breaking changes.