For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
DiscordPlatform
DocumentationIntegrationsAPI referenceSDKsChangelog
DocumentationIntegrationsAPI referenceSDKsChangelog
    • Overview
  • Tracing
  • Gateway
      • OpenAI Agents
      • Claude Agent SDK
      • Vercel AI SDK
      • Pydantic AI
      • CrewAI
      • Haystack
      • LangChain
      • LangGraph
      • Langflow
      • LlamaIndex
      • AutoGen
      • DSPy
      • Google ADK
      • Smolagents
      • Strands Agents
      • AgentSpec
      • Guardrails
      • Agno
      • MCP
      • BeeAI
      • Pipecat
      • Superagent
  • Others
  • Migrating
    • Braintrust
    • Portkey
    • Langfuse
LogoLogo
DiscordPlatform
On this page
  • Setup
  • Switch models
GatewayAgent Frameworks

AgentSpec (gateway)

Was this page helpful?
Previous

Guardrails (gateway)

Next
Built with

Route AgentSpec’s underlying LLM calls through the Respan gateway to use 250+ models from different providers. Only your RESPAN_API_KEY is needed — no separate provider keys required.

Setup

1

Install packages

$pip install respan-ai respan-instrumentation-agentspec "pyagentspec[langgraph]"
2

Set environment variables

$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"

No OPENAI_API_KEY needed — the Respan gateway handles provider authentication.

3

Point AgentSpec to the Respan gateway

1import os
2from pyagentspec.adapters.langgraph import AgentSpecLoader
3from pyagentspec.agent import Agent
4from pyagentspec.llms import OpenAiConfig
5from respan import Respan
6from respan_instrumentation_agentspec import AgentSpecInstrumentor
7
8os.environ["OPENAI_API_KEY"] = os.environ["RESPAN_API_KEY"]
9os.environ["OPENAI_BASE_URL"] = "https://api.respan.ai/api"
10
11respan = Respan(
12 app_name="agentspec-haiku-agent",
13 instrumentations=[
14 AgentSpecInstrumentor(workflow_name="agentspec_haiku_agent")
15 ],
16)
17
18try:
19 agent = Agent(
20 name="haiku_assistant",
21 description="A helpful assistant that writes haikus.",
22 llm_config=OpenAiConfig(name="openai", model_id="gpt-4.1-nano"),
23 system_prompt="You are a helpful assistant. Respond only with a haiku.",
24 )
25
26 langgraph_agent = AgentSpecLoader().load_component(agent)
27 result = langgraph_agent.invoke(
28 input={"messages": [{"role": "user", "content": "Write a haiku about recursion."}]}
29 )
30 print(result["messages"][-1].content)
31finally:
32 respan.shutdown()
33 respan.flush()

Switch models

Change the model_id parameter on OpenAiConfig to use 250+ models from different providers through the same gateway.

1llm_config = OpenAiConfig(name="openai", model_id="claude-sonnet-4-5-20250929")

See the full model list.