Python OpenAI Agents
The Python SDK is a minimal monorepo package for Python backend demos. Install it from the repository checkout; PyPI publishing is outside the first phase.
python -m pip install -e packages/sdk-python[agents]Model Provider
Section titled “Model Provider”VelaModelProvider implements the OpenAI Agents SDK model provider interface. The model name on the agent is treated as a Vela Model Slot key.
from agents import Agent, RunConfig, Runnerfrom vel4ai import create_client_from_environment, create_integrationfrom vel4ai.integrations.openai_agents import VelaAgentModelSlot, VelaModelProvider
client = create_client_from_environment(os.environ)integration = create_integration(client=client, execution_scope=scope)provider = VelaModelProvider( integration=integration, model_slots={ "agent": VelaAgentModelSlot( slot_id="agent", label="Python agent response", selection_mode="locked", required_model="openai/gpt-4.1-mini", ) },)
agent = Agent(name="Vela Python Agent", model="agent")result = Runner.run_streamed( agent, input="Vela の監査について説明して", run_config=RunConfig(model_provider=provider),)Authorization Timing
Section titled “Authorization Timing”OpenAI Agents can make more than one model call inside one run because tools, handoffs, retries, and final response generation can each ask the model again.
Vela relay credentials are short-lived and single-use, so VelaModelProvider prepares execution inside every get_response() and stream_response() call. It then creates OpenAIChatCompletionsModel with the returned baseURL, apiKey, and resolved model.
This means:
- relay credentials are not reused between model calls;
- a delegation revoke is observed before the next model call;
- audit shows each model call as its own authorization / execution pair.
If Vela returns blocked or denied, the adapter raises VelaExecutionDeniedError before the OpenAI Agents model call starts.
Backend Boundary
Section titled “Backend Boundary”Keep app credentials and relay credentials on the Python server. Browser state should contain only app-owned execution scope such as customerTenantId and delegationId.
Required environment:
VELA_APP_ID=...VELA_APP_TOKEN=...VELA_BASE_URL=http://localhost:4000 # optionalThe first implementation supports OpenAI-compatible Chat Completions model shape through OpenAI Agents SDK. LangGraph, CrewAI, LlamaIndex, PydanticAI, AutoGen, Responses API relay, and Gemini direct execution are later tasks.