Connecting an AI agent to Secureagentics involves two steps: registering the agent to obtain an agent ID, then instrumenting your agent code to send events as it runs. Once connected, Secureagentics monitors activity, enforces policies, and surfaces alerts in real time.Documentation Index
Fetch the complete documentation index at: https://docs.adrian.secureagentics.ai/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- A Secureagentics account with an active API key. Find your API key under Settings → API Keys.
- The base URL for all API calls is
https://api.secureagentics.ai/v1. - All requests require the header
Authorization: Bearer <YOUR_API_KEY>.
Register an agent
Agent registration creates a persistent record in Secureagentics that all events from that agent are linked to. You register an agent once (typically at deploy time or application startup) and reuse the returnedid for all subsequent event calls.
Registration request fields
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | A unique name for this agent within your organization. |
description | string | No | A human-readable description of what the agent does. |
framework | string | No | The framework powering the agent, e.g. openai, langchain, custom. |
Register your agent
Prepare your registration payload
Decide on a name that uniquely identifies this agent in its deployment environment. Use a naming convention such as
<service>-<environment>, for example support-bot-production or data-extractor-staging.Registration is idempotent by agent name within an environment. If you call
POST /v1/agents with a name that already exists in your account, the API returns the existing agent record rather than creating a duplicate.Send events from a running agent
Once your agent is registered, instrument it to send events to Secureagentics at each meaningful step — when it receives a prompt, generates a completion, calls a tool, or encounters an error.Event request fields
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | The event type. See supported types below. |
payload | object | Yes | Structured data describing the event. Contents vary by type. |
trace_id | string | No | An ID you assign to correlate related events into a single request trace. |
Supported event types
| Type | When to use |
|---|---|
prompt | The agent receives input from a user or upstream system. |
completion | The agent produces a response or output. |
tool_call | The agent invokes an external tool, function, or API. |
error | An exception or failure occurs during agent execution. |
Send an event
Choose the correct event type
Emit an event at each step in your agent’s execution loop. For a simple prompt-response cycle, emit one
prompt event when input arrives and one completion event when the response is ready.Call the events endpoint
Send
POST /v1/agents/{id}/events, replacing {id} with your registered agent ID.Best practices
Include the agent ID in request headers. AddX-Agent-ID: <agent_id> to all event requests. This makes it easier to trace requests in your own infrastructure logs and correlate them with Secureagentics events.
Handle registration errors gracefully. If POST /v1/agents returns a non-2xx response, log the error and consider whether to prevent the agent from starting. An unregistered agent cannot be monitored or governed.
Use trace_id to link related events. Generate a unique trace_id (a UUID works well) at the start of each user request or agent run, and include it on every event emitted during that run. This powers end-to-end request tracing in the monitoring dashboard.
Instrument all event types. Sending only prompt events gives you partial visibility. Emit completion, tool_call, and error events to get full coverage of your agent’s behavior and to enable anomaly detection.
Register once, reuse the ID. Store your agent ID in environment configuration after the first registration. Do not register a new agent on every application startup — this creates duplicate records and pollutes your agent list.