Setup
The agent example uses the workflow API available in LlamaIndex 0.13 and later. It requires a proxy configured with a model that supports native tool calling. The agent example is checked with Python 3.12,llama-index-core 0.13.0 / llama-index-llms-openai 0.5.0 and core 0.14.24 / OpenAI integration 0.8.1 using simulated HTTP responses. Validate your proxy’s policy and provider configuration separately.
Settings.llm globally applies to all LlamaIndex components that use an LLM — query engines, chat engines, agents — without further configuration.
Use the same https://runtime.xenovia.io/{proxy_id}/v1 base URL across the OpenAI-compatible integrations, including the OpenAI Agents SDK. The older /a/{proxy_id}/openai/v1 route is not part of the current runtime API.
Use llama_index.llms.openai.OpenAI for every provider the proxy can route to, including Anthropic, Groq, Bedrock, and Gemini. The model argument is a placeholder that the runtime replaces with the proxy’s configured model; provider-native LlamaIndex classes cannot target the proxy.
Embeddings
The runtime does not expose/v1/embeddings yet, so keep the embedding model pointed directly at your provider. An embeddings call sent to the proxy URL returns 404.
RAG pipeline
Agentic query engine
UseFunctionAgent so tool definitions are sent as native tools metadata. The QueryEngineTool below reuses the RAG query engine from the preceding example.
await main() instead of asyncio.run(main()), because a notebook already has an event loop. The older ReActAgent.from_tools(...) and synchronous .chat() examples do not apply to workflow agents. Modern ReActAgent remains available, but describes tools in its prompt instead of supplying the native tool metadata used by FunctionAgent.
Each LLM call, including query synthesis inside docs_search, routes through Xenovia. The session header set during setup groups these calls in Traces. Request-stage policy checks the tools offered to the model; this is separate from authorizing a local action after the model selects a tool and generates its arguments.
Session tracking
The setup example creates oneX-Xenovia-Session-Id before building the query engine and agent. Reuse it for the conversation, and create a new client and session ID for a separate conversation. Replacing llm after creating an agent does not update the client already held by that agent.
Handling policy blocks
For a direct query-engine call, a request-stage403 propagates as openai.PermissionDeniedError:
WorkflowRuntimeError. Use the following handler with the agent above; it recognizes direct and wrapped permission errors and re-raises unrelated failures:
await run_with_policy_handling(...) from your async entry point. This handles a 403 returned before streaming begins. FunctionAgent streams by default; failures after a stream has started can surface differently and must also be tested with the configured provider and response policies.