Agent IDs And Run IDs
Agent IDs and Run IDs are the minimum context needed to turn model requests into agent run records.
Without these identifiers, Alephant can still log a gateway request against a Virtual Key. With them, Alephant can group requests into agent runs, connect those runs to sessions and workflows, and make cost, policy, and debugging views much more useful.
Identifier Model
Required Headers For Agent Runs
Send these headers with gateway requests when you want requests to appear under an agent run:
Older snippets may show X-Alephant-Agent. Prefer Alephant-Agent-Id in new integrations.
Naming Recommendations
Use IDs that are stable, searchable, and safe to store in logs.
Good examples:
Avoid putting secrets, raw customer email addresses, access tokens, or regulated personal data in IDs or alephant-property-* headers.
Curl Example
TypeScript Example
Use default headers when every request from a client instance belongs to the same agent run.
If one process handles many runs, create a client per run or pass request-specific headers through the SDK request options your runtime supports.
Python Example
Multi-Step Run Pattern
Use the same Alephant-Run-Id for every model or tool call inside one task.
Use a new Alephant-Run-Id when the agent starts a different task, even if it belongs to the same user session.
n8n Workflow Pattern
For n8n workflows, use the n8n execution ID or a workflow-generated ID as the run ID.
Recommended mapping:
If you use the Alephant n8n community nodes, pass the returned requestId or requestLogId into later analytics steps. If you call the gateway through an n8n HTTP Request node, include the trace headers directly.
Paid Endpoint And Trace ID Notes
For paid endpoints, trace_id is used for financial-grade reconciliation across payment, settlement, execution, model cost, tool cost, and revenue records.
Do not replace Alephant-Run-Id with trace_id. Use them together:
Alephant-Run-Iddescribes the agent task.trace_idlinks the financial and execution records for paid endpoint activity.x-request-ididentifies an individual gateway request.
If paid endpoint activity has missing trace context, revenue and margin views may mark the call as incomplete or unattributed.
Verification Checklist
After sending requests:
- Open Logs and search by
x-request-id, run ID, or agent ID. - Open the Agent detail page and check the Runs view.
- Confirm request cost, tokens, model, provider, and latency appear under the expected Agent.
- If the run belongs to a workflow, confirm all related requests share the same Run ID.
- If the workflow is monetized, confirm payment activity and cost records share trace context.