Agent Runtime, MCP, A2A & Workflows¶
vertebra.agent provides the agent execution runtime, Model Context Protocol (MCP) and Agent-to-Agent (A2A) services, identity verification, protocol bridges, task planning trees, and DAG workflows. See OKF v0.2 & Knowledge Catalog for bundle serialization and Dataplex sync, and Agent Protocols Usage Guide for walkthroughs.
| Section | Responsibility |
|---|---|
| Agent Plugin & Harness Runtime | Mount MCP, A2A, and chat routes on App, run bounded LLM tool-calling loops, and gate destructive tools behind single-use human approval. |
| Model Context Protocol | Negotiate current and legacy MCP protocol versions, stream SSE notifications, serve SKILL.md and UI resources, verify IAP JWTs, and track async tool tasks. |
| Agent-to-Agent Protocol & Bridges | Serve JWS-signed /.well-known/agent-card.json descriptors, stream A2A task updates, and bridge MCP tools with A2A agents. |
| PlanTree, Workflows & Session Stores | Break goals into dependency trees, run parallel DAG waves with checkpointing, and store multi-turn conversation state. |
Agent Plugin & Harness Runtime¶
AgentPlugin mounts MCP, A2A, and SSE chat routes onto App. AgentRuntime coordinates multi-turn LLM generation, approval checks, and tool invocation.
AgentPluginConfig
¶
Bases: Struct
Configuration options for mounting the agentic harness.
Attributes:
| Name | Type | Description |
|---|---|---|
mcp | MCPConfig | None | Model Context Protocol server configuration, or |
a2a | A2AConfig | None | Agent-to-Agent 1.0 protocol configuration, or |
runtime | AgentRuntime | None | Pre-configured |
agent_base_path | str | HTTP route prefix for chat, turn streaming, confirmation, and session endpoints. |
observability | AgentTelemetryRecorder | None | OpenTelemetry |
queue_service | Any | Optional background |
session_store | Any | Optional |
skills | MCPSkillsConfig | SkillCatalog | None | Optional MCP skills configuration or pre-built SkillCatalog. |
AgentPlugin
¶
AgentRuntime
¶
Multi-turn execution runtime with parallel tools, confirmation gates, and retry backoff.
ConfirmationGate
¶
Human-in-the-loop gate controlling execution of sensitive mutating operations.
request_confirmation
¶
Issue a new confirmation ticket for a pending mutating tool invocation.
Tool
¶
Method and function descriptor encapsulating callable logic and a frozen ToolSpec.
invoke
¶
Authorize and invoke the tool with validated arguments and context injection.
Provider Tools¶
build_tools adapts a vertebra.typing.ToolProvider into validated Tool objects. Adapters own their operations and policies, and constructing tools opens no database connection. Operations use named parameters; positional-only and variadic signatures are rejected.
from vertebra.agent import ConfirmationGate, build_tools
from vertebra.db.adapters.bigquery import BigQueryConfig, BigQueryToolProvider
gate = ConfirmationGate()
tools = build_tools(
BigQueryToolProvider(
config=BigQueryConfig(project_id="my-project"),
maximum_bytes_billed=1_000_000,
),
confirmation_gate=gate,
)
rows = await tools["bigquery_query"].invoke(
{"sql": "SELECT @id AS id", "params": {"id": 1}}
)
Spanner's adapter exports SpannerToolProvider with optional read-only snapshot staleness. Each provider accepts a driver, config, or registry alias resolved at invocation. Mutations and ambiguous SQL, including WITH, require approval; retry with the approved confirmation_token input. Approval tickets bind to the operation, validated arguments (including defaults), and caller identity. BigQuery enforces the lowest of the provider, per-call, and configured billing caps even when the dry-run guard is disabled.
build_tools
¶
Adapt named provider operations into validated tools sharing one confirmation gate.
Raises:
| Type | Description |
|---|---|
ValueError
|
If an operation declares reserved, positional-only, or variadic parameters. |
Model Context Protocol¶
MCPCore
¶
Transport-agnostic MCP HTTP and JSON-RPC protocol engine.
Attributes:
| Name | Type | Description |
|---|---|---|
stream_broker | SseStreamBroker | Default: resolved_broker |
task_store | MCPTaskStore | Default: resolved_task_store |
skill_catalog | SkillCatalog | None | Default: SkillCatalog.coerce(skill_catalog, telemetry=self.telemetry) |
session_store | MCPSessionStore | CacheMCPSessionStore | Default: resolved_session_store |
MCPConfig
¶
Bases: FrozenBaseStruct
Server configuration for Model Context Protocol handlers.
Attributes:
| Name | Type | Description |
|---|---|---|
server_name | str | Server identifier returned in |
server_version | str | Semantic version string advertised during MCP capability discovery. |
instructions | str | System-level usage instructions provided to connecting MCP clients. |
allowed_origins | tuple[str, ...] | Allowed HTTP |
max_blob_bytes | int | Maximum decoded payload size in bytes for binary resource and tool blobs. |
tools_enabled | bool | Advertise and serve |
resources_enabled | bool | Advertise and serve |
prompts_enabled | bool | Advertise and serve |
skills_enabled | bool | Expose progressive |
tasks_enabled | bool | Enable |
path | str | HTTP path where the Streamable HTTP MCP endpoint is mounted. |
expose_well_known | bool | Whether to expose the well-known discovery manifest route. |
well_known_path | str | HTTP path for the well-known MCP discovery document. |
webmcp | Any | None | Optional |
trust_proxy_identity | bool | Trust proxy identity only with an explicitly configured identity source. |
identity_source | IdentitySource | None | Trusted IAP, mTLS, or application identity source from agent.core.identity. |
session_ttl_seconds | float | Time-to-live in seconds for legacy stateful MCP sessions. |
max_sessions | int | Maximum number of concurrent legacy MCP sessions retained in memory. |
logging | bool | Advertise and serve MCP logging capabilities and |
default_log_level | MCPLogLevel | Default minimum log severity assigned to newly created MCP sessions. |
enable_get_sse | bool | Allow legacy |
sse_heartbeat_seconds | float | Interval in seconds between SSE keepalive comments on idle streams. |
max_streams_per_owner | int | Maximum concurrent SSE streams allowed per authenticated owner key. |
resource_subscriptions | bool | Advertise and serve |
max_subscriptions_per_session | int | Maximum number of active resource URI subscriptions permitted per session. |
subscription_authorizer | Callable[..., Any] | None | Optional sync or async callable authorizing resource subscription requests. |
ui_mime_types | tuple[str, ...] | Allowed MIME types for SEP-1865 |
hide_app_only_tools | bool | Hide app-only tools from |
cache_url | str | None | Optional |
session_store | Any | None | Optional pre-configured MCP session store overriding |
task_store | Any | None | Optional pre-configured MCP task store overriding |
stream_broker | Any | None | Optional pre-configured SSE stream broker overriding |
IapIdentitySource
¶
Verify Google Cloud Identity-Aware Proxy ES256 JWT assertion headers.
Attributes:
| Name | Type | Description |
|---|---|---|
jwks | dict[str, Any] | None | Default: dict(jwks) if jwks is not None else None |
ToolRegistry
¶
Central catalog of tools (ToolSpec + Tool), resources, resource templates, and prompts.
register_tool
¶
Register a Tool descriptor (or callable) and cache its ToolSpec digest.
register_provider
¶
Adapt and register all operations from a neutral ToolProvider.
list_tools
¶
Return registered Tool descriptors sorted by name, optionally filtered by exposure.
list_specs
¶
Return registered ToolSpec items sorted by name, optionally filtered by exposure.
register_controller
¶
Discover and register all tools, prompts, and resources from a controller.
MCPSkillsConfig
¶
Bases: Struct
Configuration for MCP progressive skill discovery.
Attributes:
| Name | Type | Description |
|---|---|---|
paths | tuple[str | Path, ...] | Filesystem directories scanned for |
sources | tuple[Any, ...] | Additional |
directory_read | bool | Allow clients to list relative file paths inside |
expose_as_prompts | bool | Project discovered skills into |
list_changed | bool | Advertise and emit |
max_files_per_skill | int | Maximum number of files indexed per skill directory. |
max_bytes_per_skill | int | Maximum cumulative byte budget ( |
MCPTaskConfig
¶
Bases: Struct
Configuration options for MCP tasks execution.
Attributes:
| Name | Type | Description |
|---|---|---|
enabled | bool | Enable durable |
default_ttl_ms | int | Default retention TTL in milliseconds ( |
max_ttl_ms | int | Maximum allowed task TTL in milliseconds ( |
poll_interval_ms | int | Default polling interval hint in milliseconds returned to MCP clients. |
Agent-to-Agent Protocol & Bridges¶
AgentCard
¶
Bases: FrozenCamelizedStruct
A2A 1.0 Agent Card discoverable at /.well-known/agent-card.json.
Attributes:
| Name | Type | Description |
|---|---|---|
name | str | Human-readable agent name. |
description | str | Summary of the agent's purpose and domain expertise. |
version | str | Version string of the published agent card. |
supported_interfaces | tuple[AgentInterface, ...] | Transport endpoints ( |
capabilities | AgentCapabilities | Feature flags indicating streaming, push notification, and extended card support. |
default_input_modes | tuple[str, ...] | Default input part modalities accepted across skills. |
default_output_modes | tuple[str, ...] | Default output part modalities emitted across skills. |
skills | tuple[AgentSkill, ...] | Skills advertised by this agent for peer discovery and tool bridging. |
provider | AgentProvider | None | Organization metadata for the agent operator. |
signatures | tuple[AgentCardSignature, ...] | Detached RFC 7515 JWS signatures proving card integrity. |
A2AConfig
¶
Bases: Struct
Configuration options for the A2A 1.0 service.
Attributes:
| Name | Type | Description |
|---|---|---|
path | str | HTTP route path where the A2A JSON-RPC endpoint is mounted. |
base_url | str | None | Optional public origin ( |
agent_card_path | str | Well-known discovery route serving the public |
agent_card | AgentCard | None | Public |
card_secret | str | None | Optional signing secret or key material used to verify/sign the |
extended_card | AgentCard | None | Authenticated extended |
enable_streaming | bool | Allow |
enable_push_notifications | bool | Enable webhook registration and delivery via |
allow_insecure_webhooks | bool | Allow plain HTTP or loopback/private-network webhook URLs (for local testing only). |
max_tasks | int | Maximum number of tasks retained in |
task_ttl_seconds | int | Time-to-live in seconds ( |
cache_url | str | None | Optional |
task_store | Any | None | Optional pre-configured A2A task store overriding |
push_dispatcher | Any | None | Optional pre-configured push notification dispatcher overriding |
stream_broker | Any | None | Optional pre-configured SSE stream broker overriding |
A2AService
¶
Coordinates JSON-RPC dispatch, SSE event streaming, and durable execution for A2A 1.0.
handle_payload
¶
Process incoming raw JSON-RPC body and return response bytes.
execute_task_flow
¶
Run task execution lifecycle, transitioning states and publishing SSE events.
handle_message_stream
¶
A2A 1.0 message/stream RPC handler for initial task creation.
stream_message
¶
Stream SSE frames for a message execution until completion.
MCPToolBridge
¶
Translates A2A 1.0 skills into callable MCP Tool instances.
A2AAgentBridge
¶
Projects an MCP core engine and registry into an A2A 1.0 compliant agent service.
from_mcp_service
¶
Create an A2AService wrapping an MCPCore instance.
PlanTree, Workflows & Session Stores¶
PlanTree
¶
Hierarchical task planner managing parent-child goals and checkpoint snapshots.
Workflow
¶
WorkflowEngine
¶
Executes Workflow DAGs with parallel waves, telemetry, and live HLC broadcasting.
MemorySessionStore
¶
Process-local monotonic-TTL LRU OrderedDict session store with per-session locking.
SQLSpecSessionStore
¶
Session store persisting conversation history via parameterized SQL statements or ADK store.
AlchemySessionStore
¶
Session store persisting session rows via an SQLAlchemy async session factory.