This endpoint registers the start of a new agent interaction or “run”. It creates a new session with a unique trace_id that will be used to correlate all subsequent events for this specific agent session.
Always call this endpoint at the beginning of each new agent conversation or task to establish a tracking context.
The system prompt or initial instructions given to the agent for this session. This helps establish the agent’s intended behavior for security analysis.Example: "You are a helpful customer service assistant. You should be polite and professional. Never share customer personal information."
The unique identifier for this agent session. Use this ID for all subsequent event logging and action checking within this session.Example: "f4f4f4f4-f4f4-f4f4-f4f4-f4f4f4f4f4f4"
curl -X POST https://dev.fabraix.com/v1/register-agent-run \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "agent_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "timestamp": "2024-01-15T14:30:45.123Z", "system_prompt": "You are a helpful customer service assistant. You should be polite and professional." }'
Use the same agent_id for all runs of the same agent type. This helps with:
Analytics and monitoring
Identifying patterns across sessions
Debugging and troubleshooting
Copy
# Good: Consistent agent IDCUSTOMER_SERVICE_AGENT_ID = "cs-agent-prod-v1"# Bad: Random ID each timeagent_id = str(uuid.uuid4()) # Different every run
Descriptive System Prompts
Include clear constraints and objectives in your system prompt:
Copy
# Good: Clear boundariessystem_prompt = """You are a customer service assistant for AcmeCorp.- Help customers with product inquiries and orders- Never share customer personal information- Do not process refunds over $500 without manager approval- Always be professional and courteous"""# Bad: Vague promptsystem_prompt = "You are helpful"
Session Management
Store the trace_id properly for the entire session:
# Start a conversationtrace_id = register_agent_run( agent_id="chat-agent-v1", timestamp=datetime.now(), system_prompt="You are a helpful assistant")# Use same trace_id for entire conversationfor message in conversation: log_event(trace_id, "user", message) response = process_message(message) log_event(trace_id, "model_output", response)
# Start a tasktrace_id = register_agent_run( agent_id="task-agent-v1", timestamp=datetime.now(), system_prompt="Process customer orders")# Use trace_id throughout task executionfor order in orders_to_process: log_event(trace_id, "environment", order) result = process_order(order) log_event(trace_id, "tool", result)
# Start autonomous operationtrace_id = register_agent_run( agent_id="auto-agent-v1", timestamp=datetime.now(), system_prompt="Monitor system health and respond to issues")# Long-running agent with same trace_idwhile running: event = wait_for_event() log_event(trace_id, "environment", event) if requires_action(event): action = determine_action(event) if check_action(trace_id, action): execute_action(action)