| title | Agentic Workflows |
|---|---|
| emoji | π€ |
| colorFrom | blue |
| colorTo | gray |
| sdk | streamlit |
| sdk_version | 1.49.1 |
| app_file | app.py |
| pinned | false |
| license | mit |
| short_description | Multi-Agent Systems for Research and Database Analysis |
An intelligent multi-agent platform providing specialized AI assistants for different workflowsβfrom academic research to medical evidence gathering to database analysis. Choose your assistant and let AI agents handle the complexity while you focus on insights.
- Zero manual intervention required
- Intelligent task planning and decomposition
- Self-organizing multi-agent coordination
- Searches only credible, peer-reviewed sources
- Medical databases (PubMed, Cochrane Library)
- Academic databases (arXiv, Wikipedia, Tavily)
- APA format citations
- Structured markdown output
- Introduction, findings, and conclusions
- Comprehensive reference sections
- Publication-ready format
The research assistants use a 5-agent workflow that works collaboratively:
- Planner Agent - Breaks down research topics into actionable steps
- Research/Medical Agent - Searches credible databases and sources
- Writer Agent - Drafts well-structured summaries and reports
- Editor Agent - Reviews, critiques, and refines content
- Execution Agent - Orchestrates the entire workflow
The OpenRCA assistant uses an iterative refinement workflow:
- Database Agent - Converts natural language questions to SQL queries
- Query Executor - Runs SQL against the database
- Result Evaluator - Reviews query results for accuracy
- Query Refiner - Iteratively improves SQL based on feedback
- Result Interpreter - Translates data into natural language answers
The application includes four pages accessible via the Streamlit sidebar:
- Overview of the agentic workflow platform
- Choose between Research Assistant, Clinical Evidence, or OpenRCA
- Key features and capabilities
- Navigation to specialized assistants
Ideal for:
- Academic research papers
- Technical documentation
- Scientific literature reviews
- General knowledge gathering
Data Sources:
- π arXiv - Academic papers and preprints
- π Tavily - General web search
- π Wikipedia - Encyclopedic knowledge
Typical Use Cases:
- Computer Science & AI research
- Physics & Mathematics
- Engineering topics
- General academic inquiries
Workflow Time: 5-10 minutes
Ideal for:
- Clinical research
- Medical literature reviews
- Evidence-based medicine
- Healthcare decision support
Data Sources:
- π©Ί PubMed - Medical research papers & clinical studies
- π Cochrane Library - Systematic reviews & meta-analyses
Typical Use Cases:
- Disease research & treatment options
- Drug efficacy & safety studies
- Clinical guidelines & protocols
- Medical condition analysis
Workflow Time: 2-3 minutes
Ideal for:
- Equipment failure analysis
- Root cause investigation
- Corrective action tracking
- Maintenance data exploration
Features:
- π£οΈ Natural Language Queries - Ask questions in plain English
- π Smart SQL Generation - AI converts questions to accurate SQL
- β Iterative Refinement - Automatically improves query accuracy
- π Database Browser - Interactive table exploration with filtering
- π₯ Export Data - Download filtered results as CSV
Typical Use Cases:
- Finding most expensive failures by equipment/area
- Identifying common root causes and failure patterns
- Analyzing downtime and maintenance costs
- Reviewing corrective actions and their effectiveness
Database Schema:
- Equipment failures with timestamps and costs
- Root cause analysis records
- Corrective actions and prevention measures
- Asset hierarchy (Asset β Area β Equipment)
Workflow Time: 1-2 minutes
- Python 3.8 or higher
- OpenAI API key
- Tavily API key
- Clone the repository:
git clone https://github.com/palscruz23/agentic-workflow.git
cd agentic-workflow- Install dependencies:
pip install -r requirements.txt- Set up environment variables:
Create a .env file in the root directory:
OPENAI_API_KEY=your_openai_api_key_here
TAVILY_API_KEY=your_tavily_api_key_here- Run the application:
streamlit run app.pyThe application will open in your default browser at http://localhost:8501
You can also run the application using Docker for a containerized deployment:
Option 1: Using Docker Compose (Recommended)
- Create
.envfile with your API keys:
OPENAI_API_KEY=your_openai_api_key_here
TAVILY_API_KEY=your_tavily_api_key_here- Build and run with Docker Compose:
docker-compose up -d-
Access the application: Open your browser at
http://localhost:8501 -
Stop the container:
docker-compose downOption 2: Using Docker directly
- Build the Docker image:
docker build -t agentic-workflow .- Run the container:
docker run -d \
-p 8501:8501 \
-e OPENAI_API_KEY=your_openai_api_key_here \
-e TAVILY_API_KEY=your_tavily_api_key_here \
--name agentic-research \
agentic-workflow- View logs:
docker logs -f agentic-research- Stop the container:
docker stop agentic-research
docker rm agentic-researchagentic-workflow/
βββ app.py # Landing page (main entry point)
βββ About.py # About page with workflow details
βββ pages/
β βββ 1_Research Assistant.py # General academic research
β βββ 2_Clinical Evidence.py # Medical research
β βββ 3_OpenRCA.py # Database assistant for RCA
βββ agents/
β βββ planner_agent.py # Task planning and decomposition
β βββ research_agent.py # General research (arXiv, Tavily, Wikipedia)
β βββ medical_agent.py # Medical research (PubMed, Cochrane)
β βββ writer_agent.py # Content generation
β βββ editor_agent.py # Content review and refinement
β βββ execution_agent.py # Workflow orchestration
β βββ database_agent.py # Text-to-SQL with iterative refinement
βββ tools/
β βββ research_tools.py # arXiv, Tavily, Wikipedia search tools
β βββ medical_tools.py # PubMed, Cochrane search tools
βββ utils/
β βββ database.py # Database utilities and schema
βββ data/
β βββ rca_data.db # SQLite database for RCA
βββ requirements.txt # Python dependencies
βββ Dockerfile # Docker image configuration
βββ docker-compose.yml # Docker Compose configuration
βββ .dockerignore # Docker build ignore file
βββ .env # Environment variables (create this)
βββ README.md # This file
OPENAI_API_KEY- Your OpenAI API key (required)TAVILY_API_KEY- Your Tavily API key (required)DLAI_TAVILY_BASE_URL- Optional custom Tavily base URL
By default, the application uses gpt-4o-mini. You can modify this in app.py:
if "model" not in st.session_state:
st.session_state.model = "gpt-4o-mini" # Change thisTopic: "Transformer architecture in neural networks"
Agent Workflow:
- Planner: Breaks down into 5 steps (search arXiv, search Wikipedia, draft report, edit, finalize)
- Research Agent: Searches arXiv for papers on transformers, queries Wikipedia for background
- Writer Agent: Drafts comprehensive report with findings
- Editor Agent: Reviews and improves clarity, structure
- Execution Agent: Delivers final markdown report with references
Output: Complete research report with introduction, key findings, and APA citations
Topic: "Latest treatments for Type 2 Diabetes"
Agent Workflow:
- Planner: Creates medical research plan
- Medical Agent: Searches PubMed for clinical studies, Cochrane for systematic reviews
- Writer Agent: Compiles evidence-based summary
- Editor Agent: Refines medical terminology and accuracy
- Execution Agent: Produces clinical evidence report
Output: Evidence-based medical report with peer-reviewed sources
Question: "What are the top 3 most expensive failures?"
Agent Workflow:
- Database Agent: Converts question to SQL query
- Query Executor: Runs initial SQL query against RCA database
- Result Evaluator: Reviews if results correctly answer the question
- Query Refiner: Improves SQL to include relevant columns and fix aggregations
- Result Interpreter: Translates data into natural language answer
Output: "The top 3 most expensive failures are: 1) Mine B Concentrate Storage area with an impact of 3,492,427 AUD due to improper tensioning; 2) Mine A Haul Road area with an impact of 3,344,968 AUD due to software malfunction; and 3) Mine A Water Treatment area with an impact of 3,135,004 AUD due to thermal stress."
To add a new research tool:
- Create the tool function in
tools/research_tools.pyortools/medical_tools.py:
def new_search_tool(query: str, max_results: int = 5) -> list[dict]:
# Implementation
return results- Define the tool specification:
new_tool_def = {
"type": "function",
"function": {
"name": "new_search_tool",
"description": "Description of what this tool does",
"parameters": {...}
}
}- Add to the appropriate agent's tool mapping
Each agent can be customized by modifying the system prompts in the respective agent files:
agents/planner_agent.py- Planning strategyagents/research_agent.py- Research approachagents/writer_agent.py- Writing styleagents/editor_agent.py- Review criteria
Run the application locally to test:
streamlit run app.pyNavigate to each page to ensure:
- β Landing page displays correctly with all three assistants
- β Research Assistant can search arXiv, Tavily, Wikipedia
- β Clinical Evidence can search PubMed, Cochrane
- β OpenRCA can query database and refine SQL queries
- β OpenRCA database browser can filter and export data
- β Reports are generated with proper formatting
Issue: Import Error for agents
ImportError: cannot import name 'planner_agent' from 'agents.planner_agent'
Solution: Ensure all agent files have proper OpenAI client initialization inside functions, not at module level.
Issue: API Key Errors
ValueError: TAVILY_API_KEY not found in environment variables
Solution: Create .env file with required API keys.
Issue: Session State Errors
AttributeError: st.session_state has no attribute 'client'
Solution: The app initializes session state in init_chatbot(). Ensure it's called before using agents.
Contributions are welcome! Here's how:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Streamlit
- Powered by OpenAI GPT-4o-mini
- Research tools: arXiv, PubMed, Cochrane Library
- Web search: Tavily
- Issues: GitHub Issues
- Repository: GitHub Repository
Built with Claude, OpenAI, Streamlit | Powered by Multi-Agent AI π€