How wuxb02/medi-agent-swarm works
MediZJ is a multi-agent medical assistant with CLI and Vue/FastAPI web access. The main web workflow accepts a question, can gather structured medical background, delegates work to agents, retrieves version-governed medical evidence, validates the answer, then streams the result and citations. Major companion capabilities include persistent session and personal memory, image understanding, knowledge administration, conversation-driven evolution, and trace dashboards. The README documents these product stages; several backend modules were not sampled, so their internal call details are not inferred.
Main entry points: swarm_coordinator.py Swarm coordinator · run_service.py Run lifecycle · milvus_kb.py Medical retrieval · main.py FastAPI application
Components 27
User experience
- Web interface
frontend/src - FastAPI application
mediZJ/api/main.py - Chat endpoints
mediZJ/api/routers/chat.py - Run lifecycle
mediZJ/api/services/run_service.py - Image analysis
mediZJ/api/services/image_analyzer.py - Trace dashboard
frontend/src/views/TraceView.vue
Agent orchestration
- Questionnaire
mediZJ/core/questionnaire_manager.py - Swarm coordinator
mediZJ/swarm/swarm_coordinator.py - Agent graph
mediZJ/lgraph/supervisor_graph.py - Agent worker
mediZJ/lgraph/worker.py - Skill and tool loading
mediZJ/core/skill_loader.py - LLM client
mediZJ/core/llm_client.py
Knowledge and safety
- Medical retrieval
mediZJ/knowledge/milvus_kb.py - Knowledge catalog
mediZJ/knowledge/catalog.py - Knowledge candidates
mediZJ/knowledge/candidate_service.py - Answer validation
mediZJ/validation/medical_answer.py
State and governance
- Memory services
mediZJ/memory - Session persistence
mediZJ/memory/session_db.py - Conversation evolution
mediZJ/evolution/service.py - Evolution storage
mediZJ/evolution/storage.py
Operations and observability
- Infrastructure services
mediZJ/infrastructure - Trace collection
mediZJ/trace/context.py
Other components
- Patient
- MySQL
- Redis
- Milvus
- Vision model
Connections 33
- Patient → Web interface: asks question
- Web interface → FastAPI application: sends requests
- FastAPI application → Chat endpoints: routes requests
mediZJ/api/main.py - Chat endpoints → Run lifecycle: starts runs
- Run lifecycle → Swarm coordinator: runs agents
mediZJ/api/services/run_service.py - Swarm coordinator → Questionnaire: asks background
- Questionnaire → Web interface: streams questionnaire
- Swarm coordinator → Agent graph: dispatches work
mediZJ/swarm/swarm_coordinator.py - Agent graph → Agent worker: executes subtasks
- Agent worker → Skill and tool loading: activates skills
mediZJ/lgraph/worker.py - Agent worker → LLM client: requests completion
mediZJ/lgraph/worker.py - Swarm coordinator → Medical retrieval: gathers evidence
- Medical retrieval → Knowledge catalog: checks active versions
mediZJ/knowledge/milvus_kb.py - Medical retrieval → Milvus: searches vectors
- Swarm coordinator → Answer validation: validates answer
- Answer validation → Run lifecycle: returns safe result
- Run lifecycle → Web interface: streams result
- Chat endpoints → Image analysis: analyzes uploads
- Image analysis → Vision model: parses image
- Swarm coordinator → Memory services: loads context
mediZJ/swarm/swarm_coordinator.py - Memory services → Session persistence: reads sessions
- Session persistence → MySQL: persists sessions
mediZJ/memory/session_db.py - Memory services → Redis: stores working memory
- Medical retrieval → MySQL: reads catalog
- Knowledge candidates → Knowledge catalog: checks evidence
mediZJ/knowledge/candidate_service.py - Run lifecycle → Conversation evolution: queues review
- Conversation evolution → Evolution storage: persists evaluations
mediZJ/evolution/service.py - Evolution storage → MySQL: stores strategies
mediZJ/evolution/storage.py - Run lifecycle → Trace collection: records execution
mediZJ/api/services/run_service.py - Trace dashboard → FastAPI application: requests traces
- FastAPI application → Infrastructure services: starts services
mediZJ/api/main.py - Infrastructure services → MySQL: manages database
mediZJ/infrastructure/database.py - Infrastructure services → Redis: initializes cache
mediZJ/infrastructure/redis_client.py