Cross-Agent API Reference¶
Cross-agent communication utilities for Promptise Foundry. Exposes other in-process agents as standard LangChain tools so a primary agent can delegate to them during planning and execution. Supports per-peer ask tools and parallel broadcast to multiple peers.
CrossAgent¶
promptise.cross_agent.CrossAgent
dataclass
¶
Metadata wrapper for a peer agent to be exposed as a tool.
The wrapper is descriptive only. Behavior is implemented by tools produced
via :func:make_cross_agent_tools.
Attributes:
| Name | Type | Description |
|---|---|---|
agent |
Runnable[Any, Any]
|
A runnable agent (e.g., LangGraph or DeepAgents) that accepts
|
description |
str
|
One-line human description used in tool docs to help the calling agent decide when to delegate. |
Examples:
make_cross_agent_tools¶
promptise.cross_agent.make_cross_agent_tools(peers, *, tool_name_prefix='ask_agent_', include_broadcast=True)
¶
Create LangChain tools for cross-agent communication.
For each peer, a tool named f"{tool_name_prefix}{peer_name}" is created.
Optionally, a broadcast_to_agents tool is added to fan-out questions to
multiple peers concurrently.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
peers
|
Mapping[str, CrossAgent]
|
Mapping of peer name → :class: |
required |
tool_name_prefix
|
str
|
Prefix used for each per-peer ask tool. Defaults to
|
'ask_agent_'
|
include_broadcast
|
bool
|
When |
True
|
Returns:
| Type | Description |
|---|---|
list[BaseTool]
|
list[BaseTool]: A list of fully constructed tools ready to be appended |
list[BaseTool]
|
to the caller agent’s toolset. |
Notes
Construction does not contact peers; errors (e.g., network) surface at call time during execution of the generated tools.
Examples: