Options
| JavaScript option | Python option | Required | Description |
|---|---|---|---|
avertaApiKey | averta_api_key | No, if AVERTA_API_KEY is set | Overrides the environment key for this wrapped client. |
avertaBaseUrl | averta_base_url | No | Defaults to https://api.averta.io. |
onDecision | on_decision | No | Callback fired after request, tool-call, tool-result, and output decisions. |
requestContext | request_context | No | Stable conversation, request, and trace IDs sent to Averta. The SDK generates requestId and traceId when omitted. |
Decision Events
Request Context
Use request context to correlate SDK logs with dashboard events.| Field | Use it for |
|---|---|
conversationId | A multi-turn user-agent conversation. |
requestId | One app request, turn, or job. |
traceId | Your tracing/logging system. |
Error Handling
SDK failures throwAvertaSdkError from @averta-security/sdk-core.
Wrapping Rule
wrapOpenAI(...) and wrap_openai(...) mutate and return the client you pass in. Create a fresh OpenAI client for each distinct Averta configuration.