acoustic-carpenter-78188
05/25/2026, 9:48 AMexamples/genai/concentrate_agent.py, a near-identical mirror of the existing examples/genai/openai_agent.py that routes every LLM call through the Concentrate AI gateway.
The diff vs. openai_agent.py is intentionally tight:
• Override base_url on AsyncOpenAI to https://api.concentrate.ai/v1
• Swap the Flyte Secret from OPENAI_API_KEY to CONCENTRATE_API_KEY
• Pin a Concentrate model slug (`"gpt-5.4"`; users can swap in "auto" for least-cost routing or "openai/gpt-5.4" to provider-pin)
• Disable the openai-agents default tracing exporter (it ships traces to OpenAI's tracing endpoint, which rejects Concentrate keys)
Tool calling, agent orchestration, and Flyte task wrapping are unchanged because Concentrate exposes the same /v1/responses surface that openai-agents uses by default. Governance, failover, spend visibility, and guardrails are configured per API key in the Concentrate dashboard, so no extra code is required in the example to demo them; once traffic flows through the gateway it picks up the policy.
Context
Coordinated with @samhita-alla (see thread on the Union/Concentrate test accounts) — Samhita suggested contributing an example here as the starting point for the partnership and offered to amplify once merged. Happy to pair with a blog post on our end too.
Test plan
• ruff format + ruff check pass
• Verified Concentrate /v1/responses works end-to-end with gpt-5.4 via AsyncOpenAI(base_url=...) outside Flyte
• Verified the full openai-agents Runner path (set_default_openai_client + set_tracing_disabled + Agent(model="gpt-5.4", tools=[...])) executes a tool-call loop end-to-end against Concentrate
• Reviewer can run the full Flyte workflow against a cluster with a concentrate_api_key secret
Made with Cursor
flyteorg/flyte-sdkacoustic-carpenter-78188
05/25/2026, 9:49 AM