Skip to content

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 {"messages": [...]} and returns a result consumable by the built-in “best final text” extractor.

description str

One-line human description used in tool docs to help the calling agent decide when to delegate.

Examples:

>>> cross = CrossAgent(agent=peer_graph, description="Accurate math")

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:CrossAgent. The name becomes part of the tool id (e.g., ask_agent_mathpeer).

required
tool_name_prefix str

Prefix used for each per-peer ask tool. Defaults to "ask_agent_".

'ask_agent_'
include_broadcast bool

When True (default), also include the group fan-out tool broadcast_to_agents.

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:

>>> tools = make_cross_agent_tools({
...     "researcher": CrossAgent(agent=peer_graph, description="Web research")
... })
>>> # Attach `tools` alongside your MCP-discovered tools when building the agent.