pybotchi 3.1.2__tar.gz → 3.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pybotchi-3.4.0/PKG-INFO +539 -0
- pybotchi-3.4.0/README.md +512 -0
- pybotchi-3.4.0/pybotchi/__init__.pyi +6 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pybotchi/action.py +117 -27
- pybotchi-3.4.0/pybotchi/action.pyi +73 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pybotchi/common.py +1 -1
- pybotchi-3.4.0/pybotchi/common.pyi +86 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pybotchi/context.py +25 -1
- pybotchi-3.4.0/pybotchi/context.pyi +44 -0
- pybotchi-3.4.0/pybotchi/grpc/__init__.pyi +5 -0
- pybotchi-3.4.0/pybotchi/grpc/action.pyi +64 -0
- pybotchi-3.4.0/pybotchi/grpc/cli.pyi +12 -0
- pybotchi-3.4.0/pybotchi/grpc/common.pyi +61 -0
- pybotchi-3.4.0/pybotchi/grpc/context.pyi +22 -0
- pybotchi-3.4.0/pybotchi/grpc/exception.pyi +9 -0
- pybotchi-3.4.0/pybotchi/grpc/handler.pyi +31 -0
- pybotchi-3.4.0/pybotchi/grpc/pybotchi_pb2.pyi +3 -0
- pybotchi-3.4.0/pybotchi/grpc/pybotchi_pb2_grpc.pyi +25 -0
- pybotchi-3.4.0/pybotchi/grpc/utils.pyi +3 -0
- pybotchi-3.4.0/pybotchi/llm.pyi +22 -0
- pybotchi-3.4.0/pybotchi/mcp/__init__.pyi +5 -0
- pybotchi-3.4.0/pybotchi/mcp/action.pyi +65 -0
- pybotchi-3.4.0/pybotchi/mcp/common.pyi +64 -0
- pybotchi-3.4.0/pybotchi/mcp/context.pyi +9 -0
- pybotchi-3.4.0/pybotchi/py.typed +0 -0
- pybotchi-3.4.0/pybotchi/utils.pyi +13 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pyproject.toml +8 -8
- pybotchi-3.1.2/PKG-INFO +0 -274
- pybotchi-3.1.2/README.md +0 -247
- pybotchi-3.1.2/pybotchi/grpc/pybotchi_pb2.pyi +0 -165
- {pybotchi-3.1.2 → pybotchi-3.4.0}/LICENSE +0 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pybotchi/__init__.py +0 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pybotchi/grpc/__init__.py +0 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pybotchi/grpc/action.py +0 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pybotchi/grpc/cli.py +0 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pybotchi/grpc/common.py +0 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pybotchi/grpc/context.py +0 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pybotchi/grpc/exception.py +0 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pybotchi/grpc/handler.py +0 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pybotchi/grpc/pybotchi.proto +0 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pybotchi/grpc/pybotchi_pb2.py +0 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pybotchi/grpc/pybotchi_pb2_grpc.py +0 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pybotchi/grpc/utils.py +0 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pybotchi/llm.py +0 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pybotchi/mcp/__init__.py +0 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pybotchi/mcp/action.py +0 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pybotchi/mcp/common.py +0 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pybotchi/mcp/context.py +0 -0
- {pybotchi-3.1.2 → pybotchi-3.4.0}/pybotchi/utils.py +0 -0
pybotchi-3.4.0/PKG-INFO
ADDED
|
@@ -0,0 +1,539 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pybotchi
|
|
3
|
+
Version: 3.4.0
|
|
4
|
+
Summary: A deterministic, intent-based AI agent builder.
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Author: Alexie (Boyong) Madolid
|
|
7
|
+
Author-email: madolid.alexie@gmail.com
|
|
8
|
+
Requires-Python: >=3.12.0,<4.0
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
13
|
+
Provides-Extra: grpc
|
|
14
|
+
Provides-Extra: mcp
|
|
15
|
+
Requires-Dist: aiofiles (>=25.1.0) ; extra == "grpc"
|
|
16
|
+
Requires-Dist: click (>=8.3.1) ; extra == "grpc"
|
|
17
|
+
Requires-Dist: datamodel-code-generator[ruff] (>=0.31.2) ; extra == "mcp" or extra == "grpc"
|
|
18
|
+
Requires-Dist: grpcio (>=1.76.0) ; extra == "grpc"
|
|
19
|
+
Requires-Dist: grpcio-tools (>=1.76.0) ; extra == "grpc"
|
|
20
|
+
Requires-Dist: langchain-core (>=0.3.15)
|
|
21
|
+
Requires-Dist: mcp (>=1.15.0) ; extra == "mcp"
|
|
22
|
+
Requires-Dist: orjson (>=3.9.11)
|
|
23
|
+
Requires-Dist: pydantic (>=2.0)
|
|
24
|
+
Project-URL: Repository, https://github.com/amadolid/pybotchi
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# 🤖 PyBotchi
|
|
28
|
+
|
|
29
|
+
> _A deterministic, intent-based AI agent orchestrator with no restrictions—supports any framework and prioritizes human-reasoning approach._
|
|
30
|
+
|
|
31
|
+
[](https://www.python.org/downloads/)
|
|
32
|
+
[](LICENSE)
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 🎯 Core Philosophy
|
|
37
|
+
|
|
38
|
+
**Humans should handle the reasoning. AI should detect intent and translate natural language into processable data.**
|
|
39
|
+
|
|
40
|
+
Traditional development has successfully solved complex problems across every industry using deterministic code, APIs, and events. The real limitation isn't in execution—it's in **translation**. What if we could accept natural language and automatically route to the right logic?
|
|
41
|
+
|
|
42
|
+
PyBotchi takes a different approach from most AI frameworks: **LLMs excel at understanding intent and translating between human and computer language—not at business logic, calculations, or deterministic execution.** Let each do what it does best.
|
|
43
|
+
|
|
44
|
+
### The PyBotchi Workflow
|
|
45
|
+
|
|
46
|
+
1. **Detect & Translate** (LLM Layer) - Process natural language to extract intents and identify appropriate Actions with arguments
|
|
47
|
+
2. **Execute Logic** (Your Code) - Traditional code handles business logic, calculations, and data processing
|
|
48
|
+
3. **Generate Response** (LLM Layer) - Transform processed results back into natural language
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## ⚡ Core Architecture
|
|
53
|
+
|
|
54
|
+
**Nested Intent-Based Supervisor Agent Architecture** built on just **3 core classes**:
|
|
55
|
+
|
|
56
|
+
- **`Action`** - The central agent with a defined lifecycle for intent and execution logic
|
|
57
|
+
- **`Context`** - Universal container for conversational state, metadata, and execution context
|
|
58
|
+
- **`LLM`** - Singleton client for managing your model connection
|
|
59
|
+
|
|
60
|
+
This minimal foundation ensures extreme speed, efficiency, and maximum customizability.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 🌟 Key Features
|
|
65
|
+
|
|
66
|
+
### 🪶 **Ultra-Lightweight**
|
|
67
|
+
Only 3 core classes to master. The entire system is built on a minimal foundation that minimizes overhead while maximizing performance.
|
|
68
|
+
|
|
69
|
+
### 🏗️ **Object-Oriented Design**
|
|
70
|
+
Built on Pydantic `BaseModel` for rigorous data validation and industry-standard type hinting. Every component is inherently overridable and extendable.
|
|
71
|
+
|
|
72
|
+
### 🔧 **JSON Schema Native**
|
|
73
|
+
Automatic JSON Schema conformance for OpenAI, Gemini, and other LLM providers. Easily adaptable to any provider's specification.
|
|
74
|
+
|
|
75
|
+
### 🎣 **Action Lifecycle Hooks**
|
|
76
|
+
Fine-grained control over execution stages with overridable hooks: `pre`, `post`, `on_error`, `fallback`, `child_selection`, and `commit_context`.
|
|
77
|
+
|
|
78
|
+
### ⚡ **Highly Scalable**
|
|
79
|
+
Async-first architecture with built-in support for distributed execution via gRPC. Deploy agents remotely or across machines for massive parallel workloads.
|
|
80
|
+
|
|
81
|
+
### 🧱 **Truly Modular**
|
|
82
|
+
Agents are isolated, self-contained units. Different teams can independently develop, improve, or modify specific agents without impacting core logic.
|
|
83
|
+
|
|
84
|
+
### 🔗 **Graph By Design**
|
|
85
|
+
Structured parent-child relationships provide clear visibility into system execution and state, simplifying debugging and testing.
|
|
86
|
+
|
|
87
|
+
### 🌍 **Framework & Model Agnostic**
|
|
88
|
+
Works with any LLM client, third-party framework, or business requirement. True agnosticism through complete overridability.
|
|
89
|
+
|
|
90
|
+
### 🔌 **MCP Protocol Support**
|
|
91
|
+
Full integration with Model Context Protocol—expose your Actions as MCP tools or consume external MCP servers within your workflows.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 🚀 Quick Start
|
|
96
|
+
|
|
97
|
+
### Installation
|
|
98
|
+
|
|
99
|
+
PyBotchi requires Python 3.12 or higher.
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pip install pybotchi
|
|
103
|
+
|
|
104
|
+
# With gRPC support for distributed execution
|
|
105
|
+
pip install pybotchi[grpc]
|
|
106
|
+
|
|
107
|
+
# With MCP support for Model Context Protocol
|
|
108
|
+
pip install pybotchi[mcp]
|
|
109
|
+
|
|
110
|
+
# With both
|
|
111
|
+
pip install pybotchi[grpc,mcp]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Setup LLM
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
from langchain_openai import ChatOpenAI
|
|
118
|
+
from pybotchi import LLM
|
|
119
|
+
|
|
120
|
+
LLM.add(base=ChatOpenAI(
|
|
121
|
+
api_key="your-api-key",
|
|
122
|
+
model="gpt-4",
|
|
123
|
+
temperature=0.7,
|
|
124
|
+
))
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Simple Agent
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
from pybotchi import Action, ActionReturn
|
|
131
|
+
|
|
132
|
+
class Translation(Action):
|
|
133
|
+
"""Translate to specified language."""
|
|
134
|
+
|
|
135
|
+
async def pre(self, context):
|
|
136
|
+
message = await context.llm.ainvoke(context.prompts)
|
|
137
|
+
await context.add_response(self, message.text)
|
|
138
|
+
return ActionReturn.GO
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Agent with Fields
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
from pybotchi import Action, ActionReturn
|
|
145
|
+
|
|
146
|
+
from pydantic import Field
|
|
147
|
+
|
|
148
|
+
class MathProblem(Action):
|
|
149
|
+
"""Solve math problems."""
|
|
150
|
+
|
|
151
|
+
answer: str = Field(description="The answer to the math problem")
|
|
152
|
+
|
|
153
|
+
async def pre(self, context):
|
|
154
|
+
await context.add_response(self, self.answer)
|
|
155
|
+
return ActionReturn.GO
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Multi-Agent Declaration
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
from pybotchi import Action
|
|
162
|
+
|
|
163
|
+
class MultiAgent(Action):
|
|
164
|
+
"""AI Assistant for solving math problems and translation."""
|
|
165
|
+
|
|
166
|
+
class SolveMath(MathProblem):
|
|
167
|
+
pass
|
|
168
|
+
|
|
169
|
+
class Translate(Translation):
|
|
170
|
+
pass
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Execution
|
|
174
|
+
|
|
175
|
+
```python
|
|
176
|
+
import asyncio
|
|
177
|
+
|
|
178
|
+
from pybotchi import Context
|
|
179
|
+
|
|
180
|
+
async def test():
|
|
181
|
+
context = Context(
|
|
182
|
+
prompts=[
|
|
183
|
+
{"role": "system", "content": "You're an AI that can solve math problems and translate requests."},
|
|
184
|
+
{"role": "user", "content": "4 x 4 and explain in Filipino"}
|
|
185
|
+
],
|
|
186
|
+
)
|
|
187
|
+
await context.start(MultiAgent)
|
|
188
|
+
print(context.prompts[-1]["content"])
|
|
189
|
+
|
|
190
|
+
asyncio.run(test())
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**Result:**
|
|
194
|
+
```
|
|
195
|
+
Ang sagot sa 4 x 4 ay 16.
|
|
196
|
+
|
|
197
|
+
Paliwanag: Kapag sinabi nating 4 x 4, ibig sabihin ay apat na grupo ng apat. Kung bibilangin natin ito, makakakuha tayo ng kabuuang labing-anim (16).
|
|
198
|
+
|
|
199
|
+
Ibig sabihin, 4 + 4 + 4 + 4 = 16.
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Visualize Your Graph
|
|
203
|
+
|
|
204
|
+
```python
|
|
205
|
+
import asyncio
|
|
206
|
+
|
|
207
|
+
from pybotchi import graph
|
|
208
|
+
|
|
209
|
+
async def print_mermaid_graph():
|
|
210
|
+
multi_agent_graph = await graph(MultiAgent)
|
|
211
|
+
print(multi_agent_graph.flowchart())
|
|
212
|
+
|
|
213
|
+
run(print_mermaid_graph())
|
|
214
|
+
```
|
|
215
|
+
**Result:**
|
|
216
|
+
```
|
|
217
|
+
flowchart TD
|
|
218
|
+
__main__.MultiAgent.SolveMath[SolveMath]
|
|
219
|
+
__main__.MultiAgent{MultiAgent}
|
|
220
|
+
__main__.MultiAgent.Translate[Translate]
|
|
221
|
+
__main__.MultiAgent --> __main__.MultiAgent.SolveMath
|
|
222
|
+
__main__.MultiAgent --> __main__.MultiAgent.Translate
|
|
223
|
+
style __main__.MultiAgent fill:#4CAF50,color:#000000
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+

|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## 🧩 Action Lifecycle
|
|
231
|
+
|
|
232
|
+
Every Action follows a structured lifecycle that gives you complete control over execution flow:
|
|
233
|
+
|
|
234
|
+

|
|
235
|
+
|
|
236
|
+
### Core Lifecycle Hooks
|
|
237
|
+
|
|
238
|
+
#### **`pre`** - Pre-Execution
|
|
239
|
+
Executes before child agents run. Use for:
|
|
240
|
+
- Guardrails and validation
|
|
241
|
+
- Data gathering (RAG, knowledge graphs)
|
|
242
|
+
- Business logic and preprocessing
|
|
243
|
+
- Tool execution
|
|
244
|
+
|
|
245
|
+
#### **`child_selection`** - Agent Selection
|
|
246
|
+
Determines which child agents to execute. Override with:
|
|
247
|
+
- Traditional control flow (if/else, switch/case)
|
|
248
|
+
- Custom LLM routing logic
|
|
249
|
+
- Dynamic agent selection
|
|
250
|
+
|
|
251
|
+
#### **`post`** - Post-Processing
|
|
252
|
+
Executes after all child agents complete. Use for:
|
|
253
|
+
- Result consolidation
|
|
254
|
+
- Data persistence
|
|
255
|
+
- Cleanup and recording
|
|
256
|
+
- Logging and notifications
|
|
257
|
+
|
|
258
|
+
#### **`on_error`** - Error Handling
|
|
259
|
+
Handle errors during execution with:
|
|
260
|
+
- Retry mechanisms
|
|
261
|
+
- Custom error handling
|
|
262
|
+
- Logging and alerts
|
|
263
|
+
- Re-raise for parent handling
|
|
264
|
+
|
|
265
|
+
#### **`fallback`** - Non-Tool Results
|
|
266
|
+
Executes when no child agent is selected:
|
|
267
|
+
- Process text content results
|
|
268
|
+
- Handle non-tool-call responses
|
|
269
|
+
- Default behaviors
|
|
270
|
+
|
|
271
|
+
#### **`commit_context`** - Context Control
|
|
272
|
+
Controls context merging with main execution:
|
|
273
|
+
- Selective data propagation
|
|
274
|
+
- Isolated execution contexts
|
|
275
|
+
- Custom synchronization rules
|
|
276
|
+
|
|
277
|
+
### Extended Lifecycle Hooks
|
|
278
|
+
|
|
279
|
+
- **`pre_mcp`** - MCP connection setup (authentication, config)
|
|
280
|
+
- **`pre_grpc`** - gRPC connection setup (credentials, metadata)
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## 🎨 Everything is Overridable & Extendable
|
|
285
|
+
|
|
286
|
+
```python
|
|
287
|
+
class CustomAgent(MultiAgent):
|
|
288
|
+
SolveMath = None # Remove action
|
|
289
|
+
|
|
290
|
+
class NewAction(Action): # Add new action
|
|
291
|
+
pass
|
|
292
|
+
|
|
293
|
+
class Translate(Translation): # Override existing
|
|
294
|
+
async def pre(self, context):
|
|
295
|
+
# Custom translation logic
|
|
296
|
+
pass
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## 🔄 Execution Patterns
|
|
302
|
+
|
|
303
|
+
### Sequential Execution
|
|
304
|
+
Multiple agents execute in order via iteration or multi-tool calls.
|
|
305
|
+
|
|
306
|
+
### Concurrent Execution
|
|
307
|
+
Parallel execution using async patterns or threading:
|
|
308
|
+
|
|
309
|
+
```python
|
|
310
|
+
class ParallelAgent(Action):
|
|
311
|
+
__concurrent__ = True # Enable concurrent execution
|
|
312
|
+
|
|
313
|
+
class Task1(Action):
|
|
314
|
+
pass
|
|
315
|
+
|
|
316
|
+
class Task2(Action):
|
|
317
|
+
pass
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Nested Architectures
|
|
321
|
+
Build complex hierarchical structures:
|
|
322
|
+
|
|
323
|
+
```python
|
|
324
|
+
class ComplexAgent(Action):
|
|
325
|
+
class StoryTelling(Action):
|
|
326
|
+
class HorrorStory(Action):
|
|
327
|
+
pass
|
|
328
|
+
class ComedyStory(Action):
|
|
329
|
+
pass
|
|
330
|
+
|
|
331
|
+
class JokeTelling(Action):
|
|
332
|
+
pass
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## 🌐 Distributed Systems with gRPC
|
|
338
|
+
|
|
339
|
+
Scale your agents across multiple servers with real-time context synchronization:
|
|
340
|
+
|
|
341
|
+
**server.py**
|
|
342
|
+
```python
|
|
343
|
+
from pybotchi import Action, ActionReturn
|
|
344
|
+
|
|
345
|
+
from pydantic import Field
|
|
346
|
+
|
|
347
|
+
class MathProblem(Action):
|
|
348
|
+
"""Solve math problems."""
|
|
349
|
+
|
|
350
|
+
__groups__ = {"grpc": {"group-1"}}
|
|
351
|
+
|
|
352
|
+
answer: str = Field(description="The answer to the math problem")
|
|
353
|
+
|
|
354
|
+
async def pre(self, context):
|
|
355
|
+
await context.add_response(self, self.answer)
|
|
356
|
+
return ActionReturn.GO
|
|
357
|
+
```
|
|
358
|
+
**client.py**
|
|
359
|
+
```python
|
|
360
|
+
from asyncio import run
|
|
361
|
+
|
|
362
|
+
from pybotchi import ActionReturn
|
|
363
|
+
from pybotchi.grpc import GRPCAction, GRPCConnection, graph
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
class MultiAgent(GRPCAction):
|
|
367
|
+
__grpc_connections__ = [GRPCConnection("remote", "localhost:50051", ["group-1"])]
|
|
368
|
+
|
|
369
|
+
async def pre_grpc(self, context):
|
|
370
|
+
# Setup authentication, refresh tokens, etc.
|
|
371
|
+
return ActionReturn.GO
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
async def print_mermaid_graph():
|
|
375
|
+
multi_agent_graph = await graph(MultiAgent, integrations={"remote": {}})
|
|
376
|
+
print(multi_agent_graph.flowchart())
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
run(print_mermaid_graph())
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### Key Benefits
|
|
383
|
+
- **Unified Graph Execution** - Remote Actions integrate seamlessly
|
|
384
|
+
- **Zero-Overhead Synchronization** - No polling loops or coordination overhead
|
|
385
|
+
- **Database-Free Architecture** - Context syncs directly through gRPC
|
|
386
|
+
- **Concurrent Remote Execution** - True distributed parallel processing
|
|
387
|
+
- **Resource Isolation** - Separate compute resources per Action group
|
|
388
|
+
|
|
389
|
+
Start gRPC server:
|
|
390
|
+
```bash
|
|
391
|
+
pybotchi-grpc server.py
|
|
392
|
+
```
|
|
393
|
+
**Result**
|
|
394
|
+
```bash
|
|
395
|
+
#-------------------------------------------------------#
|
|
396
|
+
# Agent ID: agent_b6c9ada82c7444818356a6338e975c09
|
|
397
|
+
# Agent Path: server.py
|
|
398
|
+
# Agent Path: server.py
|
|
399
|
+
# Starting None worker(s) on 0.0.0.0:50051
|
|
400
|
+
#-------------------------------------------------------#
|
|
401
|
+
# Agent Path: server.py
|
|
402
|
+
# Agent Handler: PyBotchiGRPC
|
|
403
|
+
# gRPC server running on 0.0.0.0:50051
|
|
404
|
+
#-------------------------------------------------------#
|
|
405
|
+
```
|
|
406
|
+
gRPC client print graph:
|
|
407
|
+
```bash
|
|
408
|
+
python3 client.py
|
|
409
|
+
```
|
|
410
|
+
```bash
|
|
411
|
+
flowchart TD
|
|
412
|
+
__main__.MultiAgent[MultiAgent]
|
|
413
|
+
grpc.agent_b6c9ada82c7444818356a6338e975c09.MathProblem[MathProblem]
|
|
414
|
+
__main__.MultiAgent --**GRPC** : remote--> grpc.agent_b6c9ada82c7444818356a6338e975c09.MathProblem
|
|
415
|
+
style __main__.MultiAgent fill:#4CAF50,color:#000000
|
|
416
|
+
```
|
|
417
|
+

|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
## 🔌 Model Context Protocol (MCP)
|
|
421
|
+
|
|
422
|
+
Integrate with the MCP ecosystem—expose Actions as MCP tools or consume external MCP servers:
|
|
423
|
+
|
|
424
|
+
### As MCP Server
|
|
425
|
+
```python
|
|
426
|
+
from pybotchi.mcp import build_mcp_app
|
|
427
|
+
|
|
428
|
+
class MyAction(Action):
|
|
429
|
+
__groups__ = {"mcp": {"group-1"}}
|
|
430
|
+
# Your action implementation
|
|
431
|
+
|
|
432
|
+
app = build_mcp_app(transport="streamable-http")
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
### As MCP Client
|
|
436
|
+
```python
|
|
437
|
+
from pybotchi.mcp import MCPAction, MCPConnection
|
|
438
|
+
|
|
439
|
+
class Agent(MCPAction):
|
|
440
|
+
__mcp_connections__ = [
|
|
441
|
+
MCPConnection("jira", "SSE", "https://mcp.atlassian.com/v1/sse")
|
|
442
|
+
]
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
### Key Benefits
|
|
446
|
+
- **Standard Protocol Support** - Full MCP specification compatibility
|
|
447
|
+
- **Group-Based Organization** - Fine-grained access control per endpoint
|
|
448
|
+
- **Bidirectional Integration** - Serve or consume MCP tools
|
|
449
|
+
- **Transport Flexibility** - SSE and Streamable HTTP support
|
|
450
|
+
|
|
451
|
+
---
|
|
452
|
+
|
|
453
|
+
## 📚 Examples & Use Cases
|
|
454
|
+
|
|
455
|
+
Explore practical examples demonstrating PyBotchi's capabilities:
|
|
456
|
+
|
|
457
|
+
### 🚀 Getting Started
|
|
458
|
+
- [`tiny.py`](examples/tiny.py) - Minimal implementation
|
|
459
|
+
- [`full_spec.py`](examples/full_spec.py) - Complete feature demonstration
|
|
460
|
+
|
|
461
|
+
### 🔄 Flow Control
|
|
462
|
+
- [`sequential.py`](examples/sequential.py) - Sequential action execution
|
|
463
|
+
- [`nested_combination.py`](examples/nested_combination.py) - Complex nested structures
|
|
464
|
+
|
|
465
|
+
### ⚡ Concurrency
|
|
466
|
+
- [`concurrent_combination.py`](examples/concurrent_combination.py) - Async parallel execution
|
|
467
|
+
- [`concurrent_threading_combination.py`](examples/concurrent_threading_combination.py) - Multi-threaded processing
|
|
468
|
+
|
|
469
|
+
### 🌐 Distributed Systems
|
|
470
|
+
- [`grpc/grpc_pybotchi_agent.py`](examples/grpc/grpc_pybotchi_agent.py) - gRPC server setup
|
|
471
|
+
- [`grpc/grpc_pybotchi_client.py`](examples/grpc/grpc_pybotchi_client.py) - Distributed orchestration
|
|
472
|
+
|
|
473
|
+
### 🔌 MCP Integration
|
|
474
|
+
- [`mcp/mcp_pybotchi_agent.py`](examples/mcp/mcp_pybotchi_agent.py) - MCP server implementation
|
|
475
|
+
- [`mcp/mcp_pybotchi_client.py`](examples/mcp/mcp_pybotchi_client.py) - MCP client integration
|
|
476
|
+
- [`mcp/mcp_pybotchi_client_for_mcp_atlassian.py`](examples/mcp/mcp_pybotchi_client_for_mcp_atlassian.py) - Atlassian MCP integration
|
|
477
|
+
|
|
478
|
+
### 💼 Real-World Applications
|
|
479
|
+
- [`interactive_action.py`](examples/interactive_action.py) - Real-time WebSocket communication
|
|
480
|
+
|
|
481
|
+
### ⚔️ Framework Comparison
|
|
482
|
+
- [`vs/pybotchi_approach.py`](examples/vs/pybotchi_approach.py) - PyBotchi implementation
|
|
483
|
+
- [`vs/langgraph_approach.py`](examples/vs/langgraph_approach.py) - LangGraph comparison
|
|
484
|
+
|
|
485
|
+
---
|
|
486
|
+
|
|
487
|
+
## 🚀 Why Choose PyBotchi?
|
|
488
|
+
|
|
489
|
+
**Maximum flexibility, zero lock-in.** Build agents that combine human intelligence with AI precision.
|
|
490
|
+
|
|
491
|
+
Perfect for teams that need:
|
|
492
|
+
- ✅ Modular, maintainable agent architectures
|
|
493
|
+
- ✅ Framework flexibility and migration capabilities
|
|
494
|
+
- ✅ Community-driven agent development
|
|
495
|
+
- ✅ Enterprise-grade customization and control
|
|
496
|
+
- ✅ Real-time interactive agent communication
|
|
497
|
+
- ✅ Distributed execution without complexity
|
|
498
|
+
- ✅ Standard protocol integration (MCP)
|
|
499
|
+
|
|
500
|
+
---
|
|
501
|
+
|
|
502
|
+
## 📖 Documentation
|
|
503
|
+
|
|
504
|
+
Visit our [full documentation](https://amadolid.github.io/pybotchi) for:
|
|
505
|
+
- Detailed lifecycle hook explanations
|
|
506
|
+
- Advanced patterns and best practices
|
|
507
|
+
- gRPC and MCP integration guides
|
|
508
|
+
- Complete API reference
|
|
509
|
+
|
|
510
|
+
---
|
|
511
|
+
|
|
512
|
+
## 🤝 Contributing
|
|
513
|
+
|
|
514
|
+
We welcome contributions! Whether it's:
|
|
515
|
+
- Bug reports and feature requests
|
|
516
|
+
- Documentation improvements
|
|
517
|
+
- Code contributions
|
|
518
|
+
- Example applications
|
|
519
|
+
|
|
520
|
+
Check out our [contributing guidelines](CONTRIBUTING.md) to get started.
|
|
521
|
+
|
|
522
|
+
---
|
|
523
|
+
|
|
524
|
+
## 📄 License
|
|
525
|
+
|
|
526
|
+
PyBotchi is released under the MIT License. See [LICENSE](LICENSE) for details.
|
|
527
|
+
|
|
528
|
+
---
|
|
529
|
+
|
|
530
|
+
## 🌟 Community
|
|
531
|
+
|
|
532
|
+
- **GitHub**: [amadolid/pybotchi](https://github.com/amadolid/pybotchi)
|
|
533
|
+
- **Issues**: [Report bugs or request features](https://github.com/amadolid/pybotchi/issues)
|
|
534
|
+
- **Discussions**: [Join the conversation](https://github.com/amadolid/pybotchi/discussions)
|
|
535
|
+
|
|
536
|
+
---
|
|
537
|
+
|
|
538
|
+
**Ready to build smarter agents?** Start with the examples and join the community building the future of human-AI collaboration.
|
|
539
|
+
|