Install
AVERTA_API_KEY from the environment. Pass avertaApiKey or averta_api_key only when this client should use a different Averta key.
Wrap the Client
Send a Tool-capable Request
restrict_tools, the wrapper forwards only the allowed tools to OpenAI.
Continue the Tool Loop
OpenAI function calls include acall_id. Use that value when you send the result back.
Confirm Decisions
With an allowing policy and a tool call, Events should show a sequence like:tool_call and tool_result. The SDK generates requestId and traceId automatically; pass requestContext only when you need your own conversationId, requestId, or traceId.
Runnable Example
The SDK repository includes runnable OpenAI examples:OPENAI_API_KEY and AVERTA_API_KEY in examples/.env before running an example.
Chat Completions
The same wrapped client also guards supported Chat Completions calls.Python Support
Python V1 wraps syncOpenAI clients and guards responses.create(...), responses.create(stream=True, ...), responses.stream(...), chat.completions.create(...), and chat.completions.create(stream=True, ...).
Next Steps
Responses API
See the guarded Responses lifecycle.
Tools
Understand tool exposure and tool-call checks.
Output checks
Evaluate final answers before returning them.
Events
Investigate decisions in the dashboard.