How boboiazumi/hans-agent works
Hans Agent is a plugin-based LangGraph multi-agent framework. A user enters through Gradio, Discord, or the roleplay API; each interface invokes the compiled conversation graph, which summarizes context, lets the supervisor answer or use tools, and can delegate or consult sub-agents before returning a response. Plugin tools add memory, weather, and Discord messaging; the roleplay API can optionally generate speech. The README documents automatic plugin discovery, while the sampled source shows graph construction and several interface/tool implementations; internal startup wiring beyond those sources is not expanded here.
Main entry points: graph.py Conversation graph · supervisor_think.py Supervisor reasoning · state.py Conversation state · service.py Roleplay API
Components 22
User interfaces
- Gradio chat
plugins/gradio/service.py - Discord bot
plugins/discord/service.py - Roleplay API
plugins/roleplay_api/service.py - Speech generation
plugins/roleplay_api/service.py
Conversation orchestration
- Application startup
main.py - Graph and plugin setup
src/core/entrypoint.py - Conversation graph
src/core/graph.py - Context summarization
src/core/summarize_node.py - Supervisor reasoning
src/core/supervisor_think.py - Answer or route
src/core/route_decision.py - Agent dispatch
src/core/call_other_agent.py - Response finalization
src/core/supervisor_finalize.py - Conversation state
src/utils/state.py
Agent runtime
- Agent registry
src/lib/agents.py
Plugin capabilities
- Memory tool
plugins/library/service.py - Milvus memory store
plugins/library/service.py - Text embeddings
plugins/library/service.py - Weather tool
plugins/weather/service.py - Discord message tool
plugins/discord/service.py
Other components
- User
- Weather service
- Discord platform
Connections 28
- User → Gradio chat: sends chat
- User → Discord bot: sends message
- User → Roleplay API: sends request
- Application startup → Graph and plugin setup: starts setup
- Graph and plugin setup → Conversation graph: builds graph
- Graph and plugin setup → Agent registry: configures agents
- Conversation graph → Agent registry: builds agent graphs
- Conversation graph → Context summarization: dispatches node
- Conversation graph → Supervisor reasoning: dispatches node
- Conversation graph → Answer or route: dispatches node
- Conversation graph → Agent dispatch: dispatches node
- Conversation graph → Response finalization: dispatches node
- Context summarization → Conversation state: updates context
- Supervisor reasoning → Conversation state: reads and updates
- Answer or route → Conversation state: reads decision
- Agent dispatch → Agent registry: selects agent
- Response finalization → Conversation state: reads and updates
- Gradio chat → Conversation graph: invokes
- Discord bot → Conversation graph: invokes
- Roleplay API → Conversation graph: invokes
- Roleplay API → Speech generation: generates speech
- Supervisor reasoning → Memory tool: calls tool
- Supervisor reasoning → Weather tool: calls tool
- Supervisor reasoning → Discord message tool: calls tool
- Memory tool → Text embeddings: embeds text
- Memory tool → Milvus memory store: reads and writes
- Weather tool → Weather service: requests forecast
- Discord message tool → Discord platform: sends message