AI providers
Connect model API keys in Studio, then call provider-prefixed models from agents, prompts, and low-level generation code.
An AI provider integration stores the API key AGNT5 uses when your agents and prompts call a model API. You name models with a "provider/model" string, for example "openai/gpt-4o-mini" or "anthropic/claude-3-5-sonnet-20241022". In managed deployments, configure provider keys in Studio so workers can resolve credentials without putting secrets in source code.
Supported providers
Studio exposes these AI provider integrations for project and workspace configuration:
| Provider | Model prefix | API key env var |
|---|---|---|
| OpenAI | openai | OPENAI_API_KEY |
| Anthropic | anthropic | ANTHROPIC_API_KEY |
| Google AI | google or gemini | GOOGLE_API_KEY or GEMINI_API_KEY |
| Groq | groq | GROQ_API_KEY |
| OpenRouter | openrouter | OPENROUTER_API_KEY |
| Mistral AI | mistral | MISTRAL_API_KEY |
| DeepSeek | deepseek | DEEPSEEK_API_KEY |
| xAI | xai | XAI_API_KEY |
The Python and TypeScript SDKs also understand additional provider prefixes for local or advanced use, including azure, bedrock, ollama, huggingface, and hf. Those providers are not all exposed as first-class Studio integrations yet, so use ordinary environment configuration when you use them outside the Studio integration catalog.
Configure credentials
For local development, set the provider API key before your worker starts:
export OPENAI_API_KEY=sk-...
export ANTHROPIC_API_KEY=sk-ant-...
export GOOGLE_API_KEY=...
export GROQ_API_KEY=...
export OPENROUTER_API_KEY=...
export MISTRAL_API_KEY=...
export DEEPSEEK_API_KEY=...
export XAI_API_KEY=...For deployed workers, store provider keys in Studio:
- Open your project in Studio.
- Open Settings -> Integrations.
- Add the provider integration and paste the API key.
- Choose the narrowest scope that works: workspace, project, or environment-specific secret.
Your code should not pass raw provider keys. AGNT5 injects the credential into the worker environment or resolves it through the managed credential path at runtime.
Use a provider in an agent
Create an agent with a provider-prefixed model string. To change providers, change the model string and make sure the matching credential is configured.
from agnt5 import Agent
agent = Agent(
name="summarizer",
model="openai/gpt-4o-mini",
instructions="Summarize articles into three concise bullet points.",
)
result = await agent.run("Summarize the product launch notes.")
print(result.output)The same pattern works with another provider:
from agnt5 import Agent
agent = Agent(
name="summarizer",
model="anthropic/claude-3-5-sonnet-20241022",
instructions="Summarize articles into three concise bullet points.",
)Generate without an agent
Use the low-level lm.generate() API when you need one model call instead of an agent loop:
from agnt5 import lm
response = await lm.generate(
model="openai/gpt-4o-mini",
prompt="Write a one-paragraph incident summary for a resolved API outage.",
)
print(response.text)The model value still uses the same "provider/model" format, and the provider key still comes from the environment or the configured integration.
Provider-hosted tools
Provider-hosted tools run on the model provider’s infrastructure. AGNT5 sends the tool request to the provider and records the result in the model response; your worker does not execute local tool code for these calls.
from agnt5 import Agent
from agnt5.lm import BuiltInTool
agent = Agent(
name="researcher",
model="openai/gpt-4o-mini",
instructions="Use web search for current facts before answering.",
built_in_tools=[BuiltInTool.WEB_SEARCH],
)
result = await agent.run("What changed in the latest product release?")
print(result.output)| Tool | What it does | Providers |
|---|---|---|
BuiltInTool.WEB_SEARCH | Live web search with provider-returned results | OpenAI, Anthropic, Google |
BuiltInTool.CODE_INTERPRETER | Run code in a provider-hosted sandbox | OpenAI |
BuiltInTool.FILE_SEARCH | Search files hosted by the provider | OpenAI |
BuiltInTool.WEB_FETCH | Fetch the content of a specific URL | Anthropic |
You can mix provider-hosted tools with AGNT5 custom tools on the same agent. See Tools for custom tools, sandbox tools, and human-in-the-loop tools.