Integrations: agent frameworks¶
Export tools, approval and flows to agent frameworks. Each module imports its SDK lazily: install the extra first (Integrations).
agent_adapter.integrations.langgraph¶
LangGraph: tool nodes, Send tasks, reducers, interrupt approvals, flows, compression.
INTEGRATION = LangGraphIntegration()
module-attribute
¶
LangGraphApproval
¶
An ApprovalPort that pauses the graph with interrupt(); a signed resume value decides.
key signs resume values (resume_value); None is a random per-process key, so a run
resumes only in the process that paused it: give every process the same key otherwise.
Inside a compiled flow node the node raises the interrupt itself.
Raises:
| Type | Description |
|---|---|
ToolUsageError
|
|
request(request)
async
¶
The reviewer's decision for request, from the resume value at this position.
Raises:
| Type | Description |
|---|---|
GraphInterrupt
|
the graph pauses until a resume value arrives. |
ApprovalPending
|
inside a compiled flow node (the node interrupts for it). |
ApprovalAlreadyDecided
|
the answer was already used in this task. |
ToolUsageError
|
outside a LangGraph node. |
resume_value(interrupt, decision)
¶
The signed value for Command(resume={interrupt.id: ...}) answering interrupt.
LangGraphCompressor
¶
Compresses LangChain messages before your node calls its model; the state is untouched.
Tool-call ids stay paired, pinned and approval messages stay verbatim, and messages that are kept come back as the same objects.
__call__(messages, ctx=None)
async
¶
The compressed messages, for an async node.
Raises:
| Type | Description |
|---|---|
ConfigError
|
an item is not a LangChain message, or the policy cannot run. |
MissingDependency
|
langchain-core is missing and a step created a message. |
sync(messages, ctx=None)
¶
The compressed messages, for a sync node.
Raises:
| Type | Description |
|---|---|
ConfigError
|
as |
MissingDependency
|
as |
LangGraphIntegration
¶
Bases: IntegrationBase
Exports tool nodes and compiles flows; approvals pause the graph with interrupt().
ToolNode
¶
Runs tool calls as ToolMessages; tools are the definitions to bind to a model.
__call__(state, config)
async
¶
The ToolMessages answering the last AI message, as a state update.
ToolTask
¶
A Send target: runs one tool with the Send argument and writes {into: value}.
__call__(arg, config)
async
¶
Run the tool; model-visible errors become model_visible_error values.
compile_flow(flow, *, executor=None, checkpoint_key=None)
¶
flow as a LangGraph StateGraph; compile it with a checkpointer to pause and resume.
Each flow node is one LangGraph node running the local runner's node visit. Merge rules
are channels seeing every write of a superstep; pause gates go to interrupt_before
(added by the returned graph's compile()); tool approvals inside a node pause the task.
executor=None uses the default executor, read now, with LangGraphApproval().
checkpoint_key seals a paused node's progress (default: the LangGraphApproval port's
key, else a per-process key): give every process that resumes the same key.
node.finished names the changed state fields; their values (trace_state) need FlowRunner.
Raises:
| Type | Description |
|---|---|
FlowDefinitionError
|
the flow is invalid. |
FlowCompileError
|
a node name LangGraph reserves ( |
ToolUsageError
|
|
MissingDependency
|
langgraph is not installed. |
fan_out(target, over)
¶
A conditional-edge path sending each item (a mapping) of over to node target.
over is a state key holding a list, or a function of the state returning the items.
langgraph_compressor(policy, *, pinned=None, model_max_tokens=None)
¶
A compressor for state["messages"]: await c(messages) or c.sync(messages).
Raises:
| Type | Description |
|---|---|
ConfigError
|
|
one_use(node)
¶
Your own LangGraph node, run as one task execution: each approval answer is used once.
Needed around a node that calls LangGraphApproval itself (tool nodes, tool tasks and
compiled flows do this already). Executor calls the node finished before a pause replay
when it re-runs in this process. Sync or async nodes, with or without config.
Raises:
| Type | Description |
|---|---|
MissingDependency
|
langgraph or langchain-core is not installed. |
reducer(rule)
¶
A LangGraph channel applying rule to all writes of a superstep: Annotated[T, reducer(r)].
Raises:
| Type | Description |
|---|---|
ToolUsageError
|
|
MissingDependency
|
langgraph is not installed. |
run_compiled(app, state, config)
async
¶
Run a graph compiled from compile_flow until it is done, paused or denied.
state is the initial state (a model or mapping), an ApprovalDecision answering the
pending approval (bound to it), a LangGraph Command, or None to continue. Gates whose
port decides at once are passed without stopping; recursion_limit defaults to 100.
Raises:
| Type | Description |
|---|---|
ToolUsageError
|
|
FlowError
|
a node, route or merge failed, or nothing waits for a decision. |
FlowLoopExceeded
|
a route passed |
tool_node(registry, *, executor=None, messages_key='messages', concurrency=None)
¶
A LangGraph node that runs the last AI message's tool calls through the executor.
Calls whose confirm rule says yes run one at a time after the others, so their
interrupts are raised and resumed in order. executor=None uses the default executor
with LangGraphApproval() as its port.
Raises:
| Type | Description |
|---|---|
ToolUsageError
|
|
MissingDependency
|
langgraph is not installed. |
tool_task(spec, *, executor=None, into)
¶
A node for Send(node, args): runs spec with args, returns {into: value}.
Raises:
| Type | Description |
|---|---|
ToolUsageError
|
|
MissingDependency
|
langgraph is not installed. |
agent_adapter.integrations.adk¶
Google ADK 2.x: tools as BaseTools with a confirmation bridge, flows as a Workflow.
INTEGRATION = AdkIntegration()
module-attribute
¶
TARGET = 'adk'
module-attribute
¶
AdkIntegration
¶
Bases: IntegrationBase
Exports BaseTools and compiles flows to ADK Workflows.
bind_context(native)
¶
Run (invocation id), call id, thread (session id) and a state copy of a ToolContext.
Never an approval: ADK's confirmation only adds a gate in front of the executor's.
compile_flow(flow, *, executor=None, **options)
¶
compile_flow(flow, executor=executor, **options).
export_tool(spec, *, executor=None)
¶
adk_tool(spec, executor=executor).
adk_tool(spec, *, executor=None)
¶
An ADK BaseTool running spec through the executor; confirm gates via ADK.
Raises:
| Type | Description |
|---|---|
MissingDependency
|
|
IntegrationError
|
the installed ADK is outside the extra's range. |
ToolUsageError
|
|
adk_tools(registry, *, executor=None)
¶
An ADK BaseTool for every registry tool exported to adk.
bind_context(tool_context)
¶
Our context for an ADK ToolContext (run = invocation id, call = function call id).
compile_flow(flow, *, executor=None, name=None, max_steps=100, model=None)
¶
flow as an ADK Workflow (START -> aa_driver); run it with run_workflow.
node.finished names the changed state fields; their values (trace_state) need FlowRunner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
executor
|
Executor | None
|
Runs every node and tool call; default |
None
|
name
|
str | None
|
The Workflow's name (an identifier); default the flow's name. |
None
|
max_steps
|
int
|
Supersteps before |
100
|
model
|
LLMPort | None
|
Exposed to nodes through |
None
|
Raises:
| Type | Description |
|---|---|
FlowDefinitionError
|
the flow is invalid. |
FlowCompileError
|
|
ToolUsageError
|
|
resolve_confirmations(events, port, registry)
async
¶
The user Content answering every open tool confirmation in events, from port.
Registry tools are asked with validated arguments (a confirm rule that says no is
confirmed unasked; invalid arguments are refused); an approval carries a one-use token
bound to the run (the events' invocation_id), the call id, the tool and the
arguments, and may edit them. Other tools are asked with their raw arguments and cannot
be edited. Returns None when nothing is open.
Raises:
| Type | Description |
|---|---|
ApprovalPending
|
a decision is still open (every call was asked first; nothing set). |
ToolUsageError
|
the open confirmations come from several invocations (ADK takes the answers of one invocation per message), or carry no invocation id. |
resume_message(interrupt_id, decision)
¶
The user types.Content answering one interrupt with decision.
For an interrupt a compiled flow raised in this process, the response carries a one-use
token binding decision to the pending request; otherwise it carries none and the
approval port decides when the run resumes (resolve tool confirmations of an LlmAgent
with resolve_confirmations).
Raises:
| Type | Description |
|---|---|
ToolUsageError
|
|
run_workflow(workflow, state, *, session_service=None, user_id='user')
async
¶
Run a compile_flow Workflow from state, or continue it with a resume_message.
Pass the initial state (a model or mapping) to start a run in a new session, or the
types.Content from resume_message(...) to resume the paused run in its session.
checkpoint is always None: ADK's session service holds the run. visits counts the
finished node visits of this run, de-duplicated by node path. Runs of one session are
serialised in this process; across processes the host must serialise them (a losing
concurrent resume raises ApprovalAlreadyDecided, it never runs a call twice).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_service
|
Any
|
Where sessions live; default one in-memory service per process. |
None
|
Raises:
| Type | Description |
|---|---|
ToolUsageError
|
|
FlowError
|
as the local runner (the run raises what a node or merge raised). |
ApprovalAlreadyDecided
|
the answered approval was already used (a concurrent or repeated resume in another process). |
agent_adapter.integrations.openai_agents¶
OpenAI Agents SDK: registry tools as FunctionTools, and a bridge for its approval gate.
The SDK's own approval (RunState.approve, always_approve, a stored run state) is never
taken as an approval. resolve_interruptions asks the port and issues a one-use token per
approved call; without a matching token the executor asks its own port when the call runs.
INTEGRATION = OpenAIAgentsIntegration()
module-attribute
¶
OpenAIAgentsIntegration
¶
Bases: IntegrationBase
Exports FunctionTools; the SDK's needs_approval gate is the approval bridge.
function_tool(spec, *, executor=None, strict=True)
¶
A FunctionTool that runs spec through the executor; confirm maps to needs_approval.
Raises:
| Type | Description |
|---|---|
MissingDependency
|
|
ToolUsageError
|
|
IntegrationError
|
the installed SDK is outside the extra's range, lacks the run-state scope the approval tokens are bound to, or cannot switch off its failure formatter. |
function_tools(registry, *, executor=None, strict=True)
¶
function_tool for every registry tool exported to openai_agents.
resolve_interruptions(result, port, *, run_id='')
async
¶
Ask port about each pending approval and record its decision on the run state.
result is a RunResult (its to_state() is used) or a RunState (updated in place).
Pass the returned state to Runner.run(agent, state) to continue. Each approved call of
an exported tool gets a one-use token bound to this state, its call id, the tool and its
validated arguments; edits travel in the token. Pass the same run_id on every pass, so
an out-of-band store sees one run.
Raises:
| Type | Description |
|---|---|
ApprovalPending
|
a decision is still open; nothing was applied or consumed. |
ToolUsageError
|
a decision edits the arguments of a tool this bridge did not export (the edit could not reach it); raised before any decision is used. |
agent_adapter.integrations.pydantic_ai¶
Pydantic AI: registry tools as Tools, and a bridge for its deferred-approval flow.
Pydantic AI's own approval (tool_call_approved, any DeferredToolResults) is never taken
as an approval. resolve_deferred asks the port and issues a one-use token per approved
call one of these tools paused on, bound to that call's ToolCallPart object. Without a
matching token the executor asks its own port when the call runs.
INTEGRATION = PydanticAIIntegration()
module-attribute
¶
PydanticAIIntegration
¶
Bases: IntegrationBase
Exports Tools; Pydantic AI's deferred tool requests are the approval bridge.
pydantic_ai_history_processor(policy, *, pinned=None, model_max_tokens=None)
¶
A history processor for Agent(capabilities=[ProcessHistory(...)]).
Pydantic AI keeps the processed history for the rest of the run.
Raises:
| Type | Description |
|---|---|
ConfigError
|
|
pydantic_ai_tool(spec, *, executor=None)
¶
A Tool that runs spec through the executor.
With confirm set, the tool validates the arguments first and raises
ApprovalRequired when the rule (or True) asks for approval, so the agent needs
DeferredToolRequests in its output_type. Invalid arguments raise ModelRetry.
Raises:
| Type | Description |
|---|---|
MissingDependency
|
|
ToolUsageError
|
|
pydantic_ai_tools(registry, *, executor=None)
¶
pydantic_ai_tool for every registry tool exported to pydantic_ai.
resolve_deferred(requests, port, *, run_id='')
async
¶
Ask port about each call in requests.approvals; the results resume the agent.
Approvals become ToolApproved(override_args=edited_args), denials ToolDenied with a
model-visible error. Each approved call that one of this bridge's tools paused on gets a
one-use token bound to that call's ToolCallPart object (the resumed history must hold
the same object), its call id, the tool and the validated arguments it runs with.
Resume once, in this process, within a minute. Calls deferred for external execution
(requests.calls) are left to the host. Pass the previous run's run_id so out-of-band
stores see one run.
Raises:
| Type | Description |
|---|---|
ApprovalPending
|
a decision is still open; nothing was consumed. Pass the same
|
agent_adapter.integrations.llamaindex¶
LlamaIndex: registry tools as FunctionTools, and the llamaindex compression format.
INTEGRATION = LlamaIndexIntegration()
module-attribute
¶
LlamaIndexIntegration
¶
Bases: IntegrationBase
Exports FunctionTools; LlamaIndex has no call id at the tool boundary.
export_tool(spec, *, executor=None)
¶
llamaindex_tool(spec, executor=executor).
llamaindex_tool(spec, *, executor=None)
¶
A FunctionTool with fn_schema=spec.args_model; acall is async, call uses run_sync.
Approval comes from the executor's port (LlamaIndex has no gate of its own). Invalid
arguments, tool errors, denials, guardrails and run limits come back as the tool's
raw_output ({"error": {...}}); other errors propagate.
Raises:
| Type | Description |
|---|---|
MissingDependency
|
|
ToolUsageError
|
|
llamaindex_tools(registry, *, executor=None)
¶
llamaindex_tool for every registry tool exported to llamaindex.
agent_adapter.integrations.crewai¶
CrewAI: registry tools as BaseTools; _run bridges to the executor with run_sync.
INTEGRATION = CrewAIIntegration()
module-attribute
¶
CrewAIIntegration
¶
Bases: IntegrationBase
Exports BaseTools; CrewAI has no call id at the tool boundary.
export_tool(spec, *, executor=None)
¶
crewai_tool(spec, executor=executor).
crewai_tool(spec, *, executor=None)
¶
A BaseTool with args_schema=spec.args_model: _arun is async, _run uses run_sync.
CrewAI validates the arguments against args_schema first (a ValueError on failure).
Its result cache is off, so every call reaches the executor. Approval comes from the
executor's port (CrewAI has no gate of its own). Tool errors, denials, guardrails and
run limits come back as {"error": {...}}; other errors propagate.
Raises:
| Type | Description |
|---|---|
MissingDependency
|
|
ToolUsageError
|
|
crewai_tools(registry, *, executor=None)
¶
crewai_tool for every registry tool exported to crewai.
agent_adapter.integrations.agent_framework¶
Microsoft Agent Framework: ToolSpecs as FunctionTools, approval, a compression format.
MAF's approval responses are never taken as an approval. resolve_approvals asks the
approval port and issues a one-use token per approved call; without a matching token the
executor asks its own port when the call runs.
INTEGRATION = AgentFrameworkIntegration()
module-attribute
¶
AgentFrameworkIntegration
¶
Bases: IntegrationBase
Exports FunctionTools; MAF's function loop pauses confirm tools for approval.
agent_framework_tool(spec, *, executor=None)
¶
A FunctionTool for spec; any confirm rule sets approval_mode="always_require".
Raises:
| Type | Description |
|---|---|
IntegrationError
|
the installed MAF is outside the extra's range or lacks what the
bridge reads ( |
agent_framework_tools(registry, *, executor=None)
¶
FunctionTools for every registry tool exported to this target.
resolve_approvals(response, port, registry, *, session=None)
async
¶
Answer each function_approval_request of response from port, in order.
Send the returned function_approval_responses back with agent.run(..., session=).
Pass the run's session: its id is the run id the executor checks when the approved
call runs. Registry tools are asked with validated arguments (approved unasked when
their confirm rule says no); other tools with their raw arguments.
Raises:
| Type | Description |
|---|---|
ApprovalPending
|
a decision is still open (every request was asked first). |
agent_adapter.integrations.agno¶
Agno: each ToolSpec as a Function; approval through requires_confirmation.
Agno's confirmations are never taken as an approval. resolve_requirements asks the
approval port and issues a one-use token per approved call; without a matching token the
executor asks its own port when the call runs.
INTEGRATION = AgnoIntegration()
module-attribute
¶
AgnoIntegration
¶
Bases: IntegrationBase
Exports Functions; an Agno agent pauses confirm tools until they are resolved.
agno_compressed_model(model, policy, *, pinned=None, model_max_tokens=None)
¶
A copy of an Agno model that compresses the messages of each provider call.
Use it as Agent(model=agno_compressed_model(OpenAIChat(...), policy)). The run's own
message list (and the stored session) keeps the full history.
Raises:
| Type | Description |
|---|---|
ConfigError
|
|
agno_function(spec, *, executor=None)
¶
An Agno Function for spec; any confirm rule sets requires_confirmation.
Results reach Agno as JSON text (Agno shows str(result) to the model).
Raises:
| Type | Description |
|---|---|
ToolDefinitionError
|
the tool has an argument named |
IntegrationError
|
the installed Agno is outside the extra's range or lacks what the
bridge reads ( |
agno_functions(registry, *, executor=None)
¶
Agno Functions for every registry tool exported to this target.
resolve_requirements(output, port, registry)
async
¶
Confirm or reject each confirmation output paused on, from port.
Then continue with agent.acontinue_run(run_response=output). The run id is
output.run_id, the one the executor checks when the confirmed call runs. Registry
tools are asked with validated arguments (confirmed unasked when their confirm rule
says no); other tools with their raw arguments.
Raises:
| Type | Description |
|---|---|
ApprovalPending
|
a decision is still open (every call was asked first; nothing set). |
agent_adapter.integrations.strands¶
Strands Agents: each ToolSpec as an AgentTool; approval through a before-tool-call hook.
INTEGRATION = StrandsIntegration()
module-attribute
¶
StrandsIntegration
¶
Bases: IntegrationBase
Exports AgentTools; strands_approval_hook asks an approval port before a call.
strands_approval_hook(port, registry)
¶
A BeforeToolCallEvent callback: asks port about registry tools whose rule says so.
Register it with agent.hooks.add_callback(BeforeToolCallEvent, hook). A denial cancels
the call. An approval swaps in a one-call view of the tool holding a one-use token
(this hook's, bound to the agent's run, the toolUseId, the tool and its input), so the
executor does not ask again. Edits are not supported: an edit is a denial.
strands_compress_middleware(policy, *, pinned=None, model_max_tokens=None)
¶
An Input handler: agent.add_middleware(InvokeModelStage.Input, handler).
It shortens what each model call sends; agent.messages keeps the full history.
Raises:
| Type | Description |
|---|---|
ConfigError
|
|
strands_tool(spec, *, executor=None)
¶
An AgentTool for spec; results are Strands tool results (status error or success).
strands_tools(registry, *, executor=None)
¶
AgentTools for every registry tool exported to this target.
agent_adapter.integrations.haystack¶
Haystack: each ToolSpec as a Tool; approval through a before_tool confirmation hook.
INTEGRATION = HaystackIntegration()
module-attribute
¶
HaystackIntegration
¶
Bases: IntegrationBase
Exports Haystack Tools; confirmation_hook asks an approval port before calls.
bind_approval(port)
¶
A before_tool hook asking port about this module's tools.
bind_context(native)
¶
Context from the Agent State: run id, call id and the hook's token, if any.
native is (state, spec, arguments); the call is matched against the pending tool
calls of the state's last message (one claim per call id).
export_tool(spec, *, executor=None)
¶
One Tool running spec through the executor.
confirmation_hook(port, registry)
¶
A before_tool Agent hook: asks port about registry tools whose rule says so.
Register it as Agent(..., hooks={"before_tool": [hook]}). It runs Haystack's
ConfirmationHook with a port-backed strategy: a denial removes the call and tells the
model why. An approval becomes a one-use token for that pending call (run, call id,
tool, arguments), taken when it runs, so the executor does not ask again. Each hook keeps
its own tokens and drops those of an earlier step. Edits are not supported: an edit is
a denial.
haystack_tool(spec, *, executor=None)
¶
A Haystack Tool for spec with both function (via run_sync) and async_function.
haystack_tools(registry, *, executor=None)
¶
Haystack Tools for every registry tool exported to this target.
agent_adapter.integrations.claude_agent¶
Claude Agent SDK: tools on an in-process SDK MCP server; approval through can_use_tool.
claude_sdk_bridge pairs a server with its own can_use_tool gate: an approval becomes a
one-use token (60 s, dropped at the end of the turn) of that bridge only, bound to the
tool_use_id, mcp__<server>__<tool> and the final input. The bridge's own MCP server
reads the tool_use_id Claude Code sends with each tools/call and takes only that call's
token. Nothing else approves a confirm tool: without a token (allowed_tools, permission
modes, other gates) the executor's own port decides. One bridge is one run.
INTEGRATION = ClaudeAgentIntegration()
module-attribute
¶
ClaudeAgentIntegration
¶
Bases: IntegrationBase
Exports SDK MCP tools; a bridge's can_use_tool asks an approval port for Claude.
ClaudeSdkBridge
dataclass
¶
An SDK MCP server, the can_use_tool gate its tools trust, and the gate's hooks.
can_use_tool(port, registry, *, server=_DEFAULT_SERVER)
¶
A permission-only can_use_tool: it grants no tokens, so a confirm tool is asked
again by the executor's port when it runs (use claude_sdk_bridge to ask once).
claude_sdk_bridge(registry, port, *, executor=None, name=_DEFAULT_SERVER)
¶
A server named name with its gate, for one client session: ClaudeAgentOptions(
mcp_servers={bridge.name: bridge.server}, can_use_tool=bridge.can_use_tool,
hooks=bridge.hooks).
The gate asks port about this server's registry tools when their confirm rule says
so (edits become updated_input), and about every other tool under its Claude name.
Its Stop and UserPromptSubmit hooks drop unused tokens, so an approval never
outlives its turn. Everything using one bridge shares its run and its tokens.
Raises:
| Type | Description |
|---|---|
IntegrationError
|
the SDK is outside the extra's range, or |
claude_sdk_server(registry, *, executor=None, name=_DEFAULT_SERVER)
¶
An SDK MCP server config without a gate (see claude_sdk_bridge for approvals).
claude_sdk_tool(spec, *, executor=None)
¶
An SdkMcpTool for spec; a confirm tool is approved by the executor's own port.
claude_sdk_tools(registry, *, executor=None)
¶
SdkMcpTools for every registry tool exported to this target.
agent_adapter.integrations.semantic_kernel¶
Semantic Kernel: ToolSpecs as kernel functions, an approval filter, a compression format.
INTEGRATION = SemanticKernelIntegration()
module-attribute
¶
SemanticKernelIntegration
¶
Bases: IntegrationBase
Exports kernel functions; approval_filter asks an approval port before auto-calls.
bind_approval(port)
¶
An auto-function-invocation filter asking port about this module's functions.
bind_context(native)
¶
Context for one call; native is (spec, arguments).
Call id and qualified name come from the function call being invoked; run id and
the approval token from approval_filter, for exactly this call and its arguments.
export_tool(spec, *, executor=None)
¶
One kernel function running spec through the executor.
approval_filter(port, registry, *, plugin=DEFAULT_PLUGIN)
¶
An AUTO_FUNCTION_INVOCATION filter backed by port.
Register it with kernel.add_filter(FilterTypes.AUTO_FUNCTION_INVOCATION, f).
<plugin>-<function> maps back to the registry name, for plugin only (the name given
to kernel_plugin; None accepts any plugin), and the tool's confirm rule decides
whether to ask. A denial (or a pending approval) becomes the function result without
calling it. An approval is a one-use token for that invocation (run, call id, qualified
name, arguments), so the executor does not ask again. Edits are not supported: an edit
is a denial.
kernel_function(spec, *, executor=None)
¶
A KernelFunctionFromMethod for spec, its parameters taken from the JSON schema.
Results reach the kernel as JSON text for non-string values (the model sees str()).
Raises:
| Type | Description |
|---|---|
ToolDefinitionError
|
a parameter is named |
kernel_plugin(registry, *, name=DEFAULT_PLUGIN, executor=None)
¶
A KernelPlugin of the registry's tools for this target; the model sees <name>-<tool>.
agent_adapter.integrations.dspy¶
DSPy: registry tools as dspy.Tools that run through the executor.
INTEGRATION = DSPyIntegration()
module-attribute
¶
DSPyIntegration
¶
Bases: IntegrationBase
Exports dspy.Tools; DSPy has no approval gate, so the executor's port decides.
export_tool(spec, *, executor=None)
¶
One dspy.Tool for spec (ctx.extras["dspy"] is that tool).
dspy_tool(spec, *, executor=None)
¶
One dspy.Tool for spec; acall is native, sync __call__ goes through run_sync.
dspy_tools(registry, *, executor=None)
¶
A dspy.Tool for every registry tool exported to DSPy.
agent_adapter.integrations.smolagents¶
smolagents: registry tools as smolagents.Tools whose sync forward runs the executor.
INTEGRATION = SmolagentsIntegration()
module-attribute
¶
SmolagentsIntegration
¶
Bases: IntegrationBase
Exports smolagents.Tools; no native approval gate, so the executor's port decides.
export_tool(spec, *, executor=None)
¶
One smolagents.Tool for spec (ctx.extras["smolagents"] is that tool).
Raises:
| Type | Description |
|---|---|
IntegrationError
|
the tool name is not a Python identifier (smolagents needs one). |
smolagents_compressed_model(model, policy, *, pinned=None, model_max_tokens=None)
¶
A copy of a smolagents model whose generate and generate_stream get fewer messages.
Use it as CodeAgent(model=smolagents_compressed_model(model, policy), tools=...). The
agent's memory keeps every step.
Raises:
| Type | Description |
|---|---|
ConfigError
|
|
smolagents_tool(spec, *, executor=None)
¶
One smolagents.Tool for spec; its sync forward runs the executor via run_sync.
smolagents_tools(registry, *, executor=None)
¶
A smolagents.Tool for every registry tool exported to smolagents.
agent_adapter.integrations.autogen¶
AutoGen 0.7: registry tools as BaseTool subclasses that run through the executor.
INTEGRATION = AutoGenIntegration()
module-attribute
¶
AutoGenCall
dataclass
¶
One AutoGen tool call, as ctx.extras["autogen"] holds it.
AutoGenIntegration
¶
Bases: IntegrationBase
Exports BaseTools; AutoGen has no per-tool approval gate, so the executor's port decides.
AutoGen's tool-error channel is an exception from run_json: its workbench turns it into
ToolResult(is_error=True) with the message, so adapter errors propagate.
export_tool(spec, *, executor=None)
¶
One BaseTool for spec; its arguments are validated by the runner.
autogen_model_context(policy, *, initial_messages=None, pinned=None, model_max_tokens=None)
¶
A ChatCompletionContext that keeps every message and returns them compressed.
Use it as AssistantAgent(..., model_context=autogen_model_context(policy)). It holds a
callable policy, so dump_component() cannot save it.
Raises:
| Type | Description |
|---|---|
ConfigError
|
|
MissingDependency
|
autogen-core is not installed. |
autogen_tool(spec, *, executor=None)
¶
One autogen_core.tools.BaseTool for spec.
autogen_tools(registry, *, executor=None)
¶
A BaseTool for every registry tool exported to AutoGen.
agent_adapter.integrations.camel¶
CAMEL-AI: ToolSpecs as FunctionTools (the executor's port approves), a compression format.
CAMEL hands a tool only its arguments (no call id) and has no approval gate of its own,
so nothing CAMEL does can approve a confirm tool: the executor asks its own port.
INTEGRATION = CamelIntegration()
module-attribute
¶
CamelIntegration
¶
Bases: IntegrationBase
Exports FunctionTools; confirm tools are decided by the executor's port.
export_tool(spec, *, executor=None)
¶
One FunctionTool running spec through the executor.
camel_tool(spec, *, executor=None, strict=True)
¶
A CAMEL FunctionTool for spec, with the OpenAI-transformed schema.
strict follows the OpenAI integration's rule (a spec that cannot be strict is not).
Raises:
| Type | Description |
|---|---|
MissingDependency
|
CAMEL is not installed. |
IntegrationError
|
the installed CAMEL is outside the extra's range or lacks
|
camel_tools(registry, *, executor=None, strict=True)
¶
CAMEL FunctionTools for every registry tool exported to this target.
openai_tool_schema(spec, *, strict=True)
¶
The Chat Completions tool schema CAMEL sends to the model for spec.
agent_adapter.integrations.ag2¶
AG2 (the ag2 package): each ToolSpec as a FunctionTool; approval as tool middleware.
AG2's own approval_required answer ("y", "always") is never taken as an approval. The
gate approval=port installs asks that port and, on approval, issues a one-use token
bound to the conversation stream, the tool call id, the tool and its validated
arguments; without a matching token the executor asks its own port.
INTEGRATION = AG2Integration()
module-attribute
¶
AG2Integration
¶
Bases: IntegrationBase
Exports FunctionTools; bind_approval gives no gate (use ag2_tool(approval=)).
ag2_compress_policy(policy, *, pinned=None, model_max_tokens=None)
¶
An assembly policy for Agent(..., assembly=[ag2_compress_policy(policy)]).
Raises:
| Type | Description |
|---|---|
ConfigError
|
|
ag2_tool(spec, *, executor=None, approval=None, middleware=())
¶
An AG2 FunctionTool for spec.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
ToolSpec
|
The tool. |
required |
executor
|
ToolRunner | None
|
The runner (default: the default executor at call time). |
None
|
approval
|
ApprovalPort | None
|
A port asked before a call whose |
None
|
middleware
|
Iterable[Any]
|
Extra AG2 tool middleware, outermost first. |
()
|
Raises:
| Type | Description |
|---|---|
MissingDependency
|
AG2 is not installed. |
IntegrationError
|
the installed AG2 is outside the extra's range or lacks what
the bridge reads ( |
ag2_tools(registry, *, executor=None, approval=None, middleware=())
¶
AG2 FunctionTools for every registry tool exported to this target.
agent_adapter.integrations.adk.compile¶
agent_adapter.integrations.adk.compile re-exports, documented under the canonical path: compile_flow.
agent_adapter.integrations.adk.tools¶
agent_adapter.integrations.adk.tools re-exports, documented under the canonical path: adk_tool, adk_tools, bind_context, resolve_confirmations.
agent_adapter.integrations.langgraph.approval¶
agent_adapter.integrations.langgraph.approval re-exports, documented under the canonical path: LangGraphApproval.
agent_adapter.integrations.langgraph.compile¶
agent_adapter.integrations.langgraph.compile re-exports, documented under the canonical path: compile_flow, run_compiled.
agent_adapter.integrations.langgraph.tools¶
agent_adapter.integrations.langgraph.tools re-exports, documented under the canonical path: ToolNode, ToolTask, fan_out, tool_node, tool_task.