POST
/
v1
/
repo
/
{repo_id}
/
agent
curl -X POST https://api.relace.run/v1/repo/123e4567-e89b-12d3-a456-426614174000/agent \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_name": "code-analyzer",
    "agent_inputs": {
      "query": "Analyze user engagement data and create visualization plots",
      "system_prompt": "Generate comprehensive data analysis with matplotlib/plotly visualizations"
    },
    "overrides": {}
  }'
event: started
data: {"prompt_id": "prompt_123e4567-e89b-12d3-a456-426614174000"}

event: agent
data: {"content": "I'll analyze the user engagement data and create visualization plots.", "type": "reasoning"}

event: tool
data: {"tool_name": "data_analyzer", "content": "Loading dataset with 10,000 records", "status": "started"}

event: tool
data: {"tool_name": "data_analyzer", "content": "Analysis complete. Found key patterns in engagement data.", "status": "completed"}

event: agent
data: {"content": "Analysis shows 65% higher engagement on weekends with peak activity between 2-4 PM.", "type": "response"}

event: tool
data: {"tool_name": "plot_generator", "content": "Generating engagement trend visualization", "status": "started"}

event: committed
data: {"files": ["plots/engagement_trends.png", "analysis/engagement_report.md"], "message": "Add engagement analysis and visualization plots"}

event: build
data: {"event": "start", "output": "Building visualization components..."}

event: build
data: {"event": "pass", "output": "Build completed successfully"}

event: deployed
data: {"status": "success", "url": "https://app.relace.ai/repo/123e4567/viz"}

event: done
data: {"summary": "Successfully analyzed engagement data and generated 2 visualization plots"}

Path Parameters

repo_id
string
required
Repo ID

Request Body

agent_name
string
required
Name of the predefined agent to run
agent_inputs
object
required
Input parameters for the agent

Response

The agent returns a Server-Sent Events (SSE) stream with real-time updates from tool calls. The various event types indicate different stages of execution.

Event Types

started
event
Signals that the agent execution has begun
agent
event
Contains agent reasoning, analysis, and text responses
tool
event
Reports tool usage and execution results
committed
event
Indicates code changes have been made to the repository
build
event
Reports build process status and results
test
event
Reports test execution status and results
deployed
event
Signals that changes have been deployed/visualizations updated
prompt_error
event
Reports errors that occurred during agent execution
done
event
Signals that the agent execution has completed successfully
curl -X POST https://api.relace.run/v1/repo/123e4567-e89b-12d3-a456-426614174000/agent \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_name": "code-analyzer",
    "agent_inputs": {
      "query": "Analyze user engagement data and create visualization plots",
      "system_prompt": "Generate comprehensive data analysis with matplotlib/plotly visualizations"
    },
    "overrides": {}
  }'
event: started
data: {"prompt_id": "prompt_123e4567-e89b-12d3-a456-426614174000"}

event: agent
data: {"content": "I'll analyze the user engagement data and create visualization plots.", "type": "reasoning"}

event: tool
data: {"tool_name": "data_analyzer", "content": "Loading dataset with 10,000 records", "status": "started"}

event: tool
data: {"tool_name": "data_analyzer", "content": "Analysis complete. Found key patterns in engagement data.", "status": "completed"}

event: agent
data: {"content": "Analysis shows 65% higher engagement on weekends with peak activity between 2-4 PM.", "type": "response"}

event: tool
data: {"tool_name": "plot_generator", "content": "Generating engagement trend visualization", "status": "started"}

event: committed
data: {"files": ["plots/engagement_trends.png", "analysis/engagement_report.md"], "message": "Add engagement analysis and visualization plots"}

event: build
data: {"event": "start", "output": "Building visualization components..."}

event: build
data: {"event": "pass", "output": "Build completed successfully"}

event: deployed
data: {"status": "success", "url": "https://app.relace.ai/repo/123e4567/viz"}

event: done
data: {"summary": "Successfully analyzed engagement data and generated 2 visualization plots"}