You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+71-69Lines changed: 71 additions & 69 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -138,6 +138,73 @@ asyncio.run(main())
138
138
139
139
---
140
140
141
+
## 🤝 Cross-Agent Communication
142
+
143
+
DeepMCPAgent v0.5 introduces **Cross-Agent Communication** — agents that can _talk to each other_ without extra servers, message queues, or orchestration layers.
144
+
145
+
You can now attach one agent as a **peer** inside another, turning it into a callable tool.
146
+
Each peer appears automatically as `ask_agent_<name>` or can be reached via `broadcast_to_agents` for parallel reasoning across multiple agents.
147
+
148
+
This means your agents can **delegate**, **collaborate**, and **critique** each other — all through the same MCP tool interface.
149
+
It’s lightweight, model-agnostic, and fully transparent: every peer call is traced like any other tool invocation.
150
+
151
+
---
152
+
153
+
### 💻 Example
154
+
155
+
```python
156
+
import asyncio
157
+
from deepmcpagent import HTTPServerSpec, build_deep_agent
instructions="You are a lead analyst. Use peers when you need research or summarization.",
173
+
cross_agents={
174
+
"researcher": CrossAgent(agent=research_graph, description="A web research peer.")
175
+
},
176
+
trace_tools=True, # see all tool calls + peer responses in console
177
+
)
178
+
179
+
# 3️⃣ Ask a question — the main agent can now call the researcher
180
+
result =await main_graph.ainvoke({
181
+
"messages": [{"role": "user", "content": "Find recent research on AI ethics and summarize it."}]
182
+
})
183
+
184
+
print(result)
185
+
186
+
asyncio.run(main())
187
+
```
188
+
189
+
🧩 **Result:**
190
+
Your main agent automatically calls `ask_agent_researcher(...)` when it decides delegation makes sense, and the peer agent returns its best final answer — all transparently handled by the MCP layer.
191
+
192
+
---
193
+
194
+
### 💡 Use Cases
195
+
196
+
- Researcher → Writer → Editor pipelines
197
+
- Safety or reviewer peers that audit outputs
198
+
- Retrieval or reasoning specialists
199
+
- Multi-model ensembles combining small and large LLMs
200
+
201
+
No new infrastructure. No complex orchestration.
202
+
Just **agents helping agents**, powered entirely by MCP over HTTP/SSE.
203
+
204
+
> 🧠 One framework, many minds — **DeepMCPAgent** turns individual LLMs into a cooperative system.
0 commit comments