How mims-harvard/txagent works
TxAgent is a therapeutic-reasoning agent that takes a clinical question through iterative language-model reasoning and biomedical tool use to produce an evidence-grounded response. The Gradio demo is the primary documented interactive entry point; the agent also supports a command-line example. ToolRAG selects tools from their descriptions, while the agent coordinates tool calls, incorporates results, and can summarize them. The README describes interaction, contraindication, and personalized-treatment analysis across biomedical sources. Some capabilities are documented rather than visible in the excerpts, so those links are marked as documented; unsampled implementation details are not inferred.
Main entry points: txagent.py Iterative reasoning · run_txagent_app.py Gradio demo · toolrag.py ToolRAG selection · utils.py Trace checker
Components 14
User interface
- Gradio demo
run_txagent_app.py
Agent reasoning
- TxAgent orchestration
src/txagent/txagent.py - Language-model inference
src/txagent/txagent.py - Iterative reasoning
src/txagent/txagent.py - Tool execution
src/txagent/txagent.py - Tool-result summaries
src/txagent/txagent.py - Trace checker
src/txagent/utils.py - Therapeutic analysis
src/txagent/txagent.py
Tool retrieval
- ToolRAG selection
src/txagent/toolrag.py - Tool descriptions
src/txagent/txagent.py
Biomedical knowledge
- ToolUniverse tools
- Biomedical sources
Other components
- Questioner
- Treatment response
Connections 16
- Questioner → Gradio demo: submits question
run_txagent_app.py - Gradio demo → TxAgent orchestration: runs chat
run_txagent_app.py - TxAgent orchestration → Iterative reasoning: coordinates
src/txagent/txagent.py - Iterative reasoning → Language-model inference: requests generation
src/txagent/txagent.py - Iterative reasoning → ToolRAG selection: selects tools
src/txagent/txagent.py - ToolRAG selection → Tool descriptions: embeds descriptions
src/txagent/toolrag.py - ToolRAG selection → ToolUniverse tools: retrieves tool metadata
src/txagent/toolrag.py - Iterative reasoning → Tool execution: dispatches calls
src/txagent/txagent.py - Tool execution → ToolUniverse tools: executes functions
src/txagent/txagent.py - ToolUniverse tools → Biomedical sources: retrieves evidence
README.md - Iterative reasoning → Tool-result summaries: summarizes results
src/txagent/txagent.py - Iterative reasoning → Trace checker: checks trace
src/txagent/txagent.py - Iterative reasoning → Therapeutic analysis: assesses interactions
README.md - Therapeutic analysis → Biomedical sources: grounds recommendations
README.md - TxAgent orchestration → Treatment response: returns answer
- Gradio demo → Treatment response: presents answer