Skip to Content
DocsModelsProviders

Providers

String dispatch by prefix

String prefixResolves toRequired env var
claude-*, claude-opus-*, claude-sonnet-*, claude-haiku-*AnthropicModelANTHROPIC_API_KEY
gpt-*, o1-*, o3-*, o4-*OpenAIModelOPENAI_API_KEY
mistral-*, command-*, mixtral-*LiteLLMModelprovider-specific
bedrock/*LiteLLMModelAWS creds
vertex_ai/*LiteLLMModelGCP creds
ollama/*LiteLLMModellocal Ollama running
groq/*LiteLLMModelGROQ_API_KEY
litellm/*LiteLLMModel (explicit opt-in)provider-specific
echoEchoModelnone
from loomflow import Agent Agent("...", model="claude-opus-4-7") Agent("...", model="claude-haiku-4-5") Agent("...", model="gpt-4o") Agent("...", model="o3-mini") Agent("...", model="mistral-large") Agent("...", model="command-r-plus") Agent("...", model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0") Agent("...", model="vertex_ai/gemini-pro") Agent("...", model="ollama/llama3") Agent("...", model="groq/llama-3.1-70b") Agent("...", model="litellm/claude-3-haiku") # explicit opt-in

Anthropic

from loomflow import Agent agent = Agent("...", model="claude-opus-4-7") # ANTHROPIC_API_KEY must be set.

Install: pip install 'loomflow[anthropic]'.

The adapter wraps the official anthropic SDK’s AsyncAnthropic.messages.create(stream=True, ...). Tool calls serialize to Anthropic’s content-block format under the hood.

OpenAI

from loomflow import Agent agent = Agent("...", model="gpt-4o") # OPENAI_API_KEY must be set.

Install: pip install 'loomflow[openai]'.

OpenAI-compatible endpoints (Together, Fireworks, Anyscale, vLLM) work via base_url= on the underlying client.

LiteLLM (~100 providers behind one adapter)

from loomflow import Agent agent = Agent("...", model="mistral-large") agent = Agent("...", model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0") agent = Agent("...", model="ollama/llama3")

Install: pip install 'loomflow[litellm]'.

Provider auth is whatever litellm expects. Typically env vars matching the provider’s official client (AWS_PROFILE, GOOGLE_APPLICATION_CREDENTIALS, MISTRAL_API_KEY, COHERE_API_KEY, etc.). See LiteLLM’s docs for the full matrix.

Echo

agent = Agent("...", model="echo") result = await agent.run("hi") print(result.output) # "Echo: hi"

EchoModel echoes the prompt as the assistant’s reply. No tool calls, no streaming meaningful tokens. For smoke-testing the agent loop without burning real tokens.

Scripted

from loomflow import Agent, ScriptedModel, ScriptedTurn model = ScriptedModel(turns=[ ScriptedTurn(text="The answer is 42."), ScriptedTurn(tool_calls=[...]), ScriptedTurn(text="Done."), ]) agent = Agent("...", model=model)

For tests with deterministic multi-turn scenarios. Each ScriptedTurn becomes one model response; the framework consumes them in order.

Secrets handling

API keys resolve in this order inside every adapter:

  1. Explicit api_key= argument on the adapter.
  2. secrets.lookup_sync(<ENV_VAR_NAME>) if a Secrets backend is wired on Agent(tuning=Tuning(secrets=...)).
  3. os.environ[<ENV_VAR_NAME>] as the bare fallback.

For Vault / AWS Secrets Manager / 1Password, write a custom Secrets adapter. See Secrets resolution.

Per-tenant model selection. Different tenants can use different models. Pass an instance per call by constructing a different Agent per tenant, or set up a router architecture where the classifier picks a specialist with the right model.

Last updated on