Connect your agents
Route LLM calls through the Runtime Proxy and report every tool and agent step with OpenTelemetry.
An agent reaches Elgeon in two ways. Its LLM calls go through the Runtime Proxy. Everything else it does, such as calling its own tools or handing work to a sub-agent, is reported with OpenTelemetry, the open standard for tracing. Both use the same Elgeon key, and together they show each task as one connected run.
API keys
Every agent authenticates with its own key. Create one when you add an agent, or later from the agent's API keys list.
- A key is shown once, when it's created. Elgeon stores only a hash, so a lost key can't be recovered: create a new one instead.
- Choose how long it lives: never expires (the default), 30, 90 or 180 days, or 1 year.
- Rotate creates a new key while the old one keeps working, so you can switch over without downtime. Revoke the old key once your agent uses the new one.
- Revoke takes effect immediately, for both the proxy and telemetry.
Route LLM calls through the Runtime Proxy
Set your client's base URL to the proxy and add the X-Elgeon-Api-Key header. Your provider key stays as it is and is forwarded to the provider unchanged.
| Provider API | Endpoint | Client base URL |
|---|---|---|
| OpenAI Chat Completions | POST /v1/chat/completions | https://gateway.elgeon.com/v1 |
| OpenAI Responses (the OpenAI Agents SDK's default) | POST /v1/responses | https://gateway.elgeon.com/v1 |
| Anthropic Messages | POST /v1/messages | https://gateway.elgeon.com |
The calls the official SDKs make around those work too, with the same key: looking up, cancelling or deleting a stored response, listing its input items, compacting a conversation and counting tokens (/v1/responses/…, /v1/messages/count_tokens). Compacting runs the model, so it's recorded and checked like any model call; the others run no model and aren't recorded as steps. Query parameters are passed through unchanged.
from openai import OpenAI
client = OpenAI(
base_url="https://gateway.elgeon.com/v1",
default_headers={"X-Elgeon-Api-Key": "sk-elgeon-agt-..."},
)What to expect from the proxy:
- Streaming responses are passed through as they arrive.
- The provider's own responses, including its errors, reach your agent unchanged. A provider error is recorded as a failed step.
- Only metadata is recorded (model, provider, timing, outcome), never the prompt or response content.
| Status | Returned by | Meaning |
|---|---|---|
| 401 | Elgeon | The Elgeon key is missing, unknown, expired or revoked. The call was not forwarded. |
| 403 | Elgeon | A guardrail blocked the request. The call was not forwarded; the body says which rule. |
| 502 | Elgeon | The provider couldn't be reached. |
| Anything else | Your provider | Passed through unchanged. |
Elgeon's own errors use the standard problem-details format (application/problem+json) with a type, title and detail.
Report every step with OpenTelemetry
Your agent's own tools, sub-agents and agent steps never pass through the proxy, so report them with any OpenTelemetry SDK. Point its trace exporter at Elgeon and add your key:
pip install opentelemetry-sdk opentelemetry-exporter-otlp-proto-http
export OTEL_EXPORTER_OTLP_ENDPOINT="https://gateway.elgeon.com"
export OTEL_EXPORTER_OTLP_HEADERS="x-elgeon-api-key=sk-elgeon-agt-..."
export OTEL_SERVICE_NAME="support-triage-bot"The exporter sends to https://gateway.elgeon.com/v1/traces. Elgeon uses traces only; you don't need to send metrics or logs.
Then wrap each agent step and tool call in a span. To join the proxy's LLM calls to the same run, pass the current trace context with each call:
from openai import OpenAI
from opentelemetry import propagate, trace
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.trace import Status, StatusCode
provider = TracerProvider()
provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter()))
trace.set_tracer_provider(provider)
tracer = trace.get_tracer("support-triage-bot")
client = OpenAI(
base_url="https://gateway.elgeon.com/v1",
default_headers={"X-Elgeon-Api-Key": "sk-elgeon-agt-..."},
)
def handle_ticket(ticket):
# The agent step: everything below becomes part of one run.
with tracer.start_as_current_span(
"invoke_agent support-triage-bot",
attributes={
"gen_ai.operation.name": "invoke_agent",
"gen_ai.provider.name": "openai",
"gen_ai.agent.name": "support-triage-bot",
},
):
# A tool call made by your own code.
with tracer.start_as_current_span(
"execute_tool lookup_order",
attributes={
"gen_ai.operation.name": "execute_tool",
"gen_ai.tool.name": "lookup_order",
},
) as span:
order = lookup_order(ticket)
if order is None:
span.set_status(Status(StatusCode.ERROR, "order not found"))
# An LLM call through the proxy, joined to this run.
headers = {}
propagate.inject(headers) # adds the W3C traceparent header
return client.chat.completions.create(
model="gpt-4.1",
messages=[{"role": "user", "content": ticket.text}],
extra_headers=headers,
)Spans are sent in batches every few seconds. In a short-lived script, call provider.shutdown() before it exits so the last batch is sent.
Your key decides which workspace and agent a span belongs to. Anything in the span that claims a different workspace or agent is ignored.
Span attributes
Elgeon reads the standard OpenTelemetry generative-AI attributes:
| Attribute | When | Notes |
|---|---|---|
gen_ai.operation.name | Required on every span | One of invoke_agent, create_agent, execute_tool, chat, text_completion, generate_content or embeddings. Other values are shown as LLM calls. |
gen_ai.provider.name | Required, except on tool calls | For example openai or anthropic. The older gen_ai.system also works. |
gen_ai.tool.name | Tool calls | Names the step in the graph, and is what run-level policies check. |
gen_ai.agent.name | Agent steps | Names the step in the graph. |
gen_ai.request.model | LLM calls | The model requested. |
- Set the span status to error when a step fails. It is marked as failed in the run and counts toward the trust score.
- A span missing a required attribute is set aside rather than dropped, and doesn't appear in your runs.
Limits
| Limit | Value | If exceeded |
|---|---|---|
| Requests per agent | 600 per minute | 429; the exporter retries later |
| Request size | 5 MB as sent, 20 MB uncompressed | 413 |
| Spans per request | 5,000 | 413 |
| Formats | OTLP/HTTP, JSON or protobuf, optionally gzip | 415 for anything else |
Spans with malformed trace or span IDs are rejected one by one and reported back as a partial success, so the rest of the batch is still accepted. The OpenTelemetry SDKs always produce valid IDs.
How a run is formed
- All steps that share a trace ID form one run.
- Steps may arrive in any order. SDKs send a step when it finishes, so tool calls usually arrive before the agent step that contains them. Elgeon links them up as they arrive.
- A run counts as finished when no new step has arrived for 5 minutes. Its run score and run-level policy checks are computed then.
- An LLM call through the proxy without a
traceparentheader starts a new run of its own.
Next: read a run's graph.