How traversaal-ai/agentpro works
Project type and purpose
• AgentPro is a Python-based ReAct-style “agentic” framework. It isn’t a web app or microservice but a local library + CLI/Notebook entrypoint that orchestrates reasoning loops (Thought → Action → Observation → …) via an LLM and a pluggable tool set.
File structure
• Top level:
• agentpro/ → the core library
– react_agent.py: orchestration of ReAct loop
– agent.py & model.py: data classes and LLM-provider abstraction
– tools/: base_tool.py plus DuckDuckGo, calculator, SlideGen, YFinance, RAG, user-input, Ares API tools
• main.py → CLI entrypoint for interactive sessions
• cookbook/ → examples & demos (Jupyter notebooks / hackathon projects)
• setup.py, pyproject.toml, requirements.txt → packaging & dependencies
• No frontend/backend split – it’s a single Python process calling external APIs (LLM, internet search, financial data, etc.)
README insights
• Describes the ReAct pattern, LLM-agnostic model factory (create_model), and modular tool system.
• Usage: user writes agent = ReactAgent(model, tools) then agent.run(query).
Core components
a. User Interface (main.py / Notebook)
b. ReactAgent Core
c. Model Adapter Layer
d. Tool Plugins
e. External Services & APIs
f. Data Flow / Agent History Store (Thought/Action/Observation)
Relationships & interactions
• User → ReactAgent.run(query)
• ReactAgent invokes Model Adapter → HTTP call to LLM provider (OpenAI/Anthropic/HuggingFace)
• Model returns “Thought” → ReactAgent decides on Action
• If Action is “use tool X”, ReactAgent calls Tool plugin → Tool may call external API (e.g., DuckDuckGo search, YFinance, slide-gen service)
• Tool returns Observation → fed back to ReactAgent → new Thought → … → Final Answer returned to User
• All steps appended to an in-memory history log
Architectural patterns & principles
• Modular plugin architecture (Tool base class, easy to drop in/out)
• Single orchestrator (ReactAgent) enforcing the ReAct pattern
• Clear separation of concerns: orchestration vs. LLM integration vs. tool logic vs. user I/O
• Dependency Injection: model & tools passed to ReactAgent at instantiation
Relevant technologies
• Python 3.8+
• HTTP APIs: OpenAI/Anthropic or any LLM endpoint
• External services: web search (Traversaal Ares), DuckDuckGo, Yahoo Finance, slide generation
• Packaging: setuptools / pyproject.toml
• Demo environment: Jupyter notebooks in cookbook/
• Blue: core library modules (ReactAgent, model.py, agent.py)
• Green: tool plugins (each concrete tool extends base_tool.py)
• Orange: user-facing entrypoints (main.py, quick_start.ipynb)
• Red: external services/APIs
• “query” from User → ReactAgent
• “LLM call” from Model Adapter → LLM API
• “tool invocation” from ReactAgent → Tool → External Service
• “observation” back into ReactAgent loop