Built-ins
AIProviderDefinition
Bind a provider ID to its runtime, settings schema, and credential schema.
The ID appears on saved provider configuration and selects the runtime. Keep credentials in the separate credential schema and validated provider options in the settings schema.
| Setting | Type | Default | Description |
|---|---|---|---|
id | str | Required | Stable ID stored on the provider configuration.Minimum length: 1 |
documentation | str | '' | Markdown and tagged examples included in the generated developer reference. |
name | str | Required | Provider name shown when setting up a connection.Minimum length: 1 |
description | str | '' | User-facing explanation shown when choosing this provider. |
runtime | str | 'pydantic_ai' | Identifier of the runtime implementation. |
runtime_factory | Callable[[AgentRuntimeConfig], AgentRuntime] | Required | Callback that constructs a runtime for validated configuration. |
credentials_schema | type[AIProviderCredentialsSchema] | DefaultAIProviderCredentialsSchema | Pydantic schema for provider credentials. |
config_schema | type[pydantic.main.BaseModel] | Required | Pydantic schema for provider runtime settings. |
integration | Any | None | Provider-specific integration metadata. |
model_identifier_factory | Callable[[AIProviderCredentialsSchema, str | None], list[tuple[str, str]]] | None | None | Optional callback that discovers selectable model identifiers. |
model_modalities_factory | Callable[[str, AIProviderCredentialsSchema, str | None], ModelModalities | None] | None | None | Optional callback that discovers the selected model's supported modalities. |
Register a project provider using an existing runtime
Reuse the built-in provider’s runtime, credential schema and integration under a project-owned ID.
from bloomerp.agents.providers.definition import AIProviderDefinition
from bloomerp.agents.providers.registry import AI_PROVIDER_REGISTRY
original = AI_PROVIDER_REGISTRY.openai
reviews = AIProviderDefinition(
id="example_review_provider",
name="Review provider",
description="A provider entry for document review agents.",
runtime=original.runtime,
runtime_factory=original.runtime_factory,
credentials_schema=original.credentials_schema,
config_schema=original.config_schema,
integration=original.integration,
)
AI_PROVIDER_REGISTRY.register(reviews.id, reviews)Constrain provider settings for a short-answer agent
Pass the same settings schema to the definition and integration so both validate the response length cap.
from pydantic import Field
from bloomerp.agents.providers.builtins.pydantic_ai_common import PydanticAIProvider, PydanticAISettings
from bloomerp.agents.providers.builtins.pydantic_open_ai import create_openai_model
from bloomerp.agents.providers.definition import AIProviderDefinition
from bloomerp.agents.providers.registry import AI_PROVIDER_REGISTRY, pydantic_runtime
class ShortAnswerSettings(PydanticAISettings):
'''Apply a smaller output limit for short-answer agents.'''
max_tokens: int = Field(default=256, gt=0, le=512, strict=True)
short_answers = AIProviderDefinition(
id="example_short_answers",
name="Short-answer provider",
runtime_factory=pydantic_runtime,
config_schema=ShortAnswerSettings,
integration=PydanticAIProvider(create_openai_model, ShortAnswerSettings),
)
AI_PROVIDER_REGISTRY.register(short_answers.id, short_answers)OpenAI
ID openai
Use OpenAI agents through the Responses API, including compatible reasoning models.
| Field | Value |
|---|---|
runtime | pydantic_ai |
DefaultAIProviderCredentialsSchema
Require an explicit API key for the built-in remote providers.
| Setting | Type | Default | Description |
|---|---|---|---|
api_key | pydantic.types.SecretStr | Required | — |
PydanticAISettings
Allow documented model controls without bypassing the tool/secret boundary.
max_tokens is a per-response output cap, separate from the run's token
budget. Provider-specific settings can be added deliberately as needed.
Arbitrary headers, request bodies, and provider-hosted tools are not accepted.
| Setting | Type | Default | Description |
|---|---|---|---|
max_tokens | int | None | None | Output token limit per response. Leave blank for the provider default.Greater than: 0 |
temperature | float | None | None | Sampling temperature from 0 to 2. Leave blank for the model default; reasoning models may not support this control.At least: 0At most: 2 |
top_p | float | None | None | Nucleus sampling probability from 0 to 1. Leave blank for the model default.At least: 0At most: 1 |
parallel_tool_calls | bool | None | None | Allow multiple tool calls in one response, or use the provider default. |
seed | int | None | None | Optional deterministic sampling seed, where supported by the model. |
stop_sequences | list[str] | None | None | Stop generation when one of these strings is reached. Enter one string per line. |
openai_reasoning_effort | Optional[Literal['none', 'minimal', 'low', 'medium', 'high', 'xhigh']] | None | Reasoning effort for compatible OpenAI agents. Leave blank for the model default. |
OpenAI Chat Completions
ID openai_chat
Use OpenAI or compatible endpoints through the Chat Completions API.
| Field | Value |
|---|---|
runtime | pydantic_ai |
DefaultAIProviderCredentialsSchema
Require an explicit API key for the built-in remote providers.
| Setting | Type | Default | Description |
|---|---|---|---|
api_key | pydantic.types.SecretStr | Required | — |
PydanticAISettings
Allow documented model controls without bypassing the tool/secret boundary.
max_tokens is a per-response output cap, separate from the run's token
budget. Provider-specific settings can be added deliberately as needed.
Arbitrary headers, request bodies, and provider-hosted tools are not accepted.
| Setting | Type | Default | Description |
|---|---|---|---|
max_tokens | int | None | None | Output token limit per response. Leave blank for the provider default.Greater than: 0 |
temperature | float | None | None | Sampling temperature from 0 to 2. Leave blank for the model default; reasoning models may not support this control.At least: 0At most: 2 |
top_p | float | None | None | Nucleus sampling probability from 0 to 1. Leave blank for the model default.At least: 0At most: 1 |
parallel_tool_calls | bool | None | None | Allow multiple tool calls in one response, or use the provider default. |
seed | int | None | None | Optional deterministic sampling seed, where supported by the model. |
stop_sequences | list[str] | None | None | Stop generation when one of these strings is reached. Enter one string per line. |
openai_reasoning_effort | Optional[Literal['none', 'minimal', 'low', 'medium', 'high', 'xhigh']] | None | Reasoning effort for compatible OpenAI agents. Leave blank for the model default. |
DeepSeek
ID deepseek
Use DeepSeek models through its OpenAI-compatible Chat Completions API.
| Field | Value |
|---|---|
runtime | pydantic_ai |
DefaultAIProviderCredentialsSchema
Require an explicit API key for the built-in remote providers.
| Setting | Type | Default | Description |
|---|---|---|---|
api_key | pydantic.types.SecretStr | Required | — |
PydanticAISettings
Allow documented model controls without bypassing the tool/secret boundary.
max_tokens is a per-response output cap, separate from the run's token
budget. Provider-specific settings can be added deliberately as needed.
Arbitrary headers, request bodies, and provider-hosted tools are not accepted.
| Setting | Type | Default | Description |
|---|---|---|---|
max_tokens | int | None | None | Output token limit per response. Leave blank for the provider default.Greater than: 0 |
temperature | float | None | None | Sampling temperature from 0 to 2. Leave blank for the model default; reasoning models may not support this control.At least: 0At most: 2 |
top_p | float | None | None | Nucleus sampling probability from 0 to 1. Leave blank for the model default.At least: 0At most: 1 |
parallel_tool_calls | bool | None | None | Allow multiple tool calls in one response, or use the provider default. |
seed | int | None | None | Optional deterministic sampling seed, where supported by the model. |
stop_sequences | list[str] | None | None | Stop generation when one of these strings is reached. Enter one string per line. |
openai_reasoning_effort | Optional[Literal['none', 'minimal', 'low', 'medium', 'high', 'xhigh']] | None | Reasoning effort for compatible OpenAI agents. Leave blank for the model default. |
Anthropic
ID anthropic
Use Claude models through the Anthropic Messages API.
| Field | Value |
|---|---|
runtime | pydantic_ai |
DefaultAIProviderCredentialsSchema
Require an explicit API key for the built-in remote providers.
| Setting | Type | Default | Description |
|---|---|---|---|
api_key | pydantic.types.SecretStr | Required | — |
AnthropicSettings
Validate the settings supported by the built-in Anthropic integration.
| Setting | Type | Default | Description |
|---|---|---|---|
max_tokens | int | None | 4096 | Output token limit per response. Defaults to 4096 tokens for Anthropic.Greater than: 0 |
temperature | float | None | None | Sampling temperature from 0 to 2. Leave blank for the model default; reasoning models may not support this control.At least: 0At most: 2 |
top_p | float | None | None | Nucleus sampling probability from 0 to 1. Leave blank for the model default.At least: 0At most: 1 |
parallel_tool_calls | bool | None | None | Allow multiple tool calls in one response, or use the provider default. |
seed | int | None | None | Optional deterministic sampling seed, where supported by the model. |
stop_sequences | list[str] | None | None | Stop generation when one of these strings is reached. Enter one string per line. |
openai_reasoning_effort | Optional[Literal['none', 'minimal', 'low', 'medium', 'high', 'xhigh']] | None | Reasoning effort for compatible OpenAI agents. Leave blank for the model default. |
OpenRouter
ID openrouter
Use OpenRouter with a vendor/model identifier. Available tools and settings depend on the selected model.
| Field | Value |
|---|---|
runtime | pydantic_ai |
DefaultAIProviderCredentialsSchema
Require an explicit API key for the built-in remote providers.
| Setting | Type | Default | Description |
|---|---|---|---|
api_key | pydantic.types.SecretStr | Required | — |
PydanticAISettings
Allow documented model controls without bypassing the tool/secret boundary.
max_tokens is a per-response output cap, separate from the run's token
budget. Provider-specific settings can be added deliberately as needed.
Arbitrary headers, request bodies, and provider-hosted tools are not accepted.
| Setting | Type | Default | Description |
|---|---|---|---|
max_tokens | int | None | None | Output token limit per response. Leave blank for the provider default.Greater than: 0 |
temperature | float | None | None | Sampling temperature from 0 to 2. Leave blank for the model default; reasoning models may not support this control.At least: 0At most: 2 |
top_p | float | None | None | Nucleus sampling probability from 0 to 1. Leave blank for the model default.At least: 0At most: 1 |
parallel_tool_calls | bool | None | None | Allow multiple tool calls in one response, or use the provider default. |
seed | int | None | None | Optional deterministic sampling seed, where supported by the model. |
stop_sequences | list[str] | None | None | Stop generation when one of these strings is reached. Enter one string per line. |
openai_reasoning_effort | Optional[Literal['none', 'minimal', 'low', 'medium', 'high', 'xhigh']] | None | Reasoning effort for compatible OpenAI agents. Leave blank for the model default. |
