Tetsuo Dox Agent is a research agent, designed for technically-focused responses with citations. Built on a graph-based architecture.
The agent:
- Drafts detailed, technically accurate answers
- Performs systematic self-reflection and validation
- Conducts thorough research across multiple sources
- Iteratively refines responses based on discovered information
- Maintains strict citation standards for factual claims
- Technical Focus: Delivers purely factual, technical information without ethical commentary
- Iterative Refinement: Automatically improves answers through multiple rounds of:
- Self-reflection and critique
- Web-based research
- Content revision
- Citation verification
- Research Integration: Leverages Tavily Search API for real-time fact-checking and research
- Structured Output:
- Primary response (250-word default limit)
- Numbered citations [1], [2], etc.
- Complete reference list with URLs and publication dates
- Research queries and self-reflections (in verbose mode)
- Quality Controls:
- Automatic fact verification
- Citation management
- Self-critique for information gaps
- Technical accuracy verification
- Python 3.13
- Poetry for dependency management
- OpenAI API key (GPT-4 access required)
- Tavily API key
- Clone the repository:
git clone https://github.com/7etsuo/tetsuo-dox-agent.git
cd dox-agent
- Install dependencies with Poetry:
# Initialize Poetry environment with Python 3.13
poetry env use python3.13
# Install dependencies
poetry install
- Set up environment variables by creating a
.env
file:
# Required Configuration
OPENAI_API_KEY=your_openai_key_here # Required: OpenAI API key with GPT-4 access
TAVILY_API_KEY=your_tavily_key_here # Required: Tavily API key for research
# Optional Configuration
MAX_ITERATIONS=3 # Optional: Number of research-revise cycles (default: 3)
MODEL_NAME=gpt-4-turbo-preview # Optional: OpenAI model choice
MAX_RESULTS=5 # Optional: Maximum search results per query
# Optional LangSmith Integration
LANGCHAIN_API_KEY=your_langsmith_key # Optional: For LangSmith tracing
LANGCHAIN_TRACING_V2=true # Optional: Enable LangSmith tracing
LANGCHAIN_PROJECT=your_project_name # Optional: LangSmith project name
- Build the Docker image:
docker-compose build
-
Set up environment variables in
.env
file (same as standard installation) -
Run the agent using Docker:
docker-compose run --rm dox-agent "Your question here"
Basic usage with default settings:
poetry run dox-agent "Your technical question here"
Customize the agent's behavior:
# Enable verbose output (includes reflections and research queries)
poetry run dox-agent --verbose "Your question"
# Customize iterations and model
poetry run dox-agent --max-iterations 4 --model gpt-4 "Your question"
# Save full response to JSON file
poetry run dox-agent --save-output results.json "Your question"
-m, --max-iterations
: Maximum research-revise cycles-l, --model
: OpenAI model selection (default: gpt-4-turbo-preview)-r, --max-results
: Maximum search results per query-w, --word-limit
: Word limit for answers (default: 250)-v, --verbose
: Enable detailed output including reflections-s, --save-output
: Save complete response to JSON file--help
: Display help message
Standard output includes:
- Technical response (within word limit)
- Numbered citations [1]
- Reference list with:
- Author (when available)
- Title
- Publication/Website
- URL
- Publication Date
Verbose output (-v) adds:
- Self-reflection on response quality
- Identified knowledge gaps
- Research queries
- Search results summary
dox_agent/
├── __init__.py
├── __main__.py
├── chains.py # Chain definitions
├── cli.py # Command line interface
├── config/ # Configuration and settings
│ ├── __init__.py
│ ├── constants.py
│ └── settings.py
├── exceptions.py # Custom exceptions
├── graph/ # Graph-based architecture
│ ├── __init__.py
│ ├── builder.py
│ └── nodes.py
├── models/ # Pydantic models
│ ├── __init__.py
│ ├── answer.py
│ └── reflection.py
├── prompts.py # Prompt templates
├── tools/ # Search tools
│ ├── __init__.py
│ └── search.py
└── types.py # Type definitions
The system operates through a graph-based architecture with three primary stages:
-
Initial Draft
- Analyzes the question
- Generates initial technical response
- Performs self-critique
-
Research Phase
- Generates targeted search queries
- Executes web searches
- Collects and processes results
-
Revision Phase
- Incorporates new information
- Updates citations
- Refines technical accuracy
- Maintains word limit
This process iterates according to the max_iterations setting or until optimal quality is achieved.
- Clone and install as described above
- Install development dependencies:
poetry install --with dev
-
New Models
- Add Pydantic models in
models/
- Update type hints accordingly
- Add Pydantic models in
-
New Tools
- Implement tool classes in
tools/
- Register in tools registry if applicable
- Implement tool classes in
-
New Graph Nodes
- Add nodes in
graph/nodes.py
- Update graph builder in
graph/builder.py
- Add nodes in
- Follow PEP 8 guidelines
- Use type hints
- Include docstrings for public interfaces
- Keep functions focused and modular
# Run test suite (TODO: Add comprehensive tests)
poetry run pytest
# Run with coverage
poetry run pytest --cov=dox_agent
- Fork the repository
- Create your feature branch:
git checkout -b feature/your-feature-name
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin feature/your-feature-name
- Open a Pull Request
- Include test cases for new features
- Update documentation as needed
- Follow existing code style
- One feature/fix per PR
- Built with LangChain
- Uses LangGraph for workflow management
- Search powered by Tavily
- Developed with OpenAI GPT-4 technology
- Open an issue for bugs or feature requests
- Check existing issues before creating new ones