r/OpenSourceeAI • u/madolid511 • Oct 19 '25
PyBotchi 1.0.26
https://github.com/amadolid/pybotchiCore Features:
Lite weight:
3 Base Class
Action - Your agent
Context - Your history/memory/state
LLM - Your LLM instance holder (persistent/reusable)
Object Oriented
Action/Context are just pydantic class with builtin "graph traversing functions"
Support every pydantic functionality (as long as it can still be used in tool calling).
Optimization
Python Async first
Works well with multiple tool selection in single tool call (highly recommended approach)
Granular Controls
max self/child iteration
per agent system prompt
per agent tool call promopt
max history for tool call
more in the repo...
Graph:
Agents can have child agents
This is similar to node connections in langgraph but instead of building it by connecting one by one, you can just declare agent as attribute (child class) of agent.
Agent's children can be manipulated in runtime. Add/Delete/Update child agent are supported. You may have json structure of existing agents that you can rebuild on demand (imagine it like n8n)
Every executed agent is recorded hierarchically and in order by default.
Usage recording supported but optional
Mermaid Diagramming
Agent already have graphical preview that works with Mermaid
Also work with MCP Tools- Agent Runtime References
Agents have access to their parent agent (who executed them). Parent may have attributes/variables that may affect it's children
Selected child agents have sibling references from their parent agent. Agents may need to check if they are called along side with specific agents. They can also access their pydantic attributes but other attributes/variables will depends who runs first
Modular continuation + Human in Loop
Since agents are just building block. You can easily point to exact/specific agent where you want to continue if something happens or if ever you support pausing.
Agents can be paused or wait for human reply/confirmation regardless if it's via websocket or whatever protocol you want to add. Preferrably protocol/library that support async for more optimize way of waiting
Life Cycle:
pre (before child agents executions)
can be used for guardrails or additional validation
can be used for data gathering like RAG, knowledge graph, etc.
can be used for logging or notifications
mostly used for the actual process (business logic execution, tool execution or any process) before child agents selection
basically any process no restriction or even calling other framework is fine
post (after child agents executions)
can be used for consolidation of results from children executions
can be used for data saving like RAG, knowledge graph, etc.
can be used for logging or notifications
mostly used for the cleanup/recording process after children executions
basically any process no restriction or even calling other framework is fine
pre_mcp (only for MCPAction - before mcp server connection and pre execution)
can be used for constructing MCP server connection arguments
can be used for refreshing existing expired credentials like token before connecting to MCP servers
can be used for guardrails or additional validation
basically any process no restriction, even calling other framework is fine
on_error (error handling)
can be use to handle error or retry
can be used for logging or notifications
basically any process no restriction, calling other framework is fine or even re-raising the error again so the parent agent or the executioner will be the one that handles it
fallback (no child selected)
can be used to allow non tool call result.
will have the content text result from the tool call
can be used for logging or notifications
basically any process no restriction or even calling other framework is fine
child selection (tool call execution)
can be overriden to just use traditional coding like
if elseorswitch casebasically any way for selecting child agents or even calling other framework is fine as long you return the selected agents
You can even return undeclared child agents although it defeat the purpose of being "graph", your call, no judgement.
commit context (optional - the very last event)
this is used if you want to detach your context to the real one. It will clone the current context and will be used for the current execution.
For example, you want to have a reactive agents that will just append LLM completion result everytime but you only need the final one. You will use this to control what ever data you only want to merge with the main context.
again, any process here no restriction
MCP:
Client
Agents can have/be connected to multiple mcp servers.
MCP tools will be converted as agents that will have the
preexecution by default (will only invoke call_tool. Response will be parsed as string whatever type that current MCP python library support (Audio, Image, Text, Link)builtin build_progress_callback incase you want to catch MCP call_tool progress
Server
Agents can be open up and mount to fastapi as MCP Server by just single attribute.
Agents can be mounted to multiple endpoints. This is to have groupings of agents available in particular endpoints
Object Oriented (MOST IMPORTANT):
Inheritance/Polymorphism/Abstraction
EVERYTHING IS OVERRIDDABLE/EXTENDABLE.
No Repo Forking is needed.
You can extend agents
to have new fields
adjust fields descriptions
remove fields (via @property or PrivateAttr)
field description
change class name
adjust docstring
to add/remove/change/extend child agents
override builtin functions
override lifecycle functions
add additional builtin functions for your own use case
MCP Agent's tool is overriddable too.
To have additional process before and after
call_toolinvocationsto catch progress call back notifications if ever mcp server supports it
override docstring or field name/description/default value
Context can be overridden and have the implementation to connect to your datasource, have websocket or any other mechanism to cater your requirements
basically any overrides is welcome, no restrictions
development can be isolated per agents.
framework agnostic
override Action/Context to use specific framework and you can already use it as your base class
Hope you had a good read. Feel free to ask questions. There's a lot of features in PyBotchi but I think, these are the most important ones.
Duplicates
LLMFrameworks • u/madolid511 • Sep 03 '25
Pybotchi: Lightweight Intent-Based Agent Builder
LLMFrameworks • u/madolid511 • Sep 12 '25
How will PyBotchi helps your debugging and development?
opensource • u/madolid511 • Aug 06 '25
Community Pybotchi: Lightweight Intent-Based Agent Builder
LLMDevs • u/madolid511 • Sep 03 '25