{"id":30294306,"url":"https://github.com/snehalyelmati/rex","last_synced_at":"2026-04-10T22:43:34.462Z","repository":{"id":308597139,"uuid":"1010633385","full_name":"snehalyelmati/rex","owner":"snehalyelmati","description":"A modular, general-purpose agent built with LangGraph, MCP, and LangSmith — demonstrated via GitHub code analysis.","archived":false,"fork":false,"pushed_at":"2025-08-06T19:44:29.000Z","size":9218,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-06T20:44:29.220Z","etag":null,"topics":["agent-framework","langgraph","langsmith","mcp","plan-and-execute","react-agent","streamlit"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snehalyelmati.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-29T13:45:00.000Z","updated_at":"2025-08-06T19:44:32.000Z","dependencies_parsed_at":"2025-08-06T20:54:37.318Z","dependency_job_id":null,"html_url":"https://github.com/snehalyelmati/rex","commit_stats":null,"previous_names":["snehalyelmati/rex"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/snehalyelmati/rex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snehalyelmati%2Frex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snehalyelmati%2Frex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snehalyelmati%2Frex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snehalyelmati%2Frex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snehalyelmati","download_url":"https://codeload.github.com/snehalyelmati/rex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snehalyelmati%2Frex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270796210,"owners_count":24647316,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent-framework","langgraph","langsmith","mcp","plan-and-execute","react-agent","streamlit"],"created_at":"2025-08-17T01:21:54.415Z","updated_at":"2026-04-10T22:43:29.422Z","avatar_url":"https://github.com/snehalyelmati.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rex - Repo Explorer 🎛️\n\n**A modular, general-purpose agent built with LangGraph, MCP, and LangSmith - demonstrated via GitHub code analysis.**\n\n## 🚀 What It Does\n\nRex is a **Plan‑and‑Execute agent** architecture built from scratch using **LangGraph**, instrumented via **MCP servers**, with **LangSmith tracing**, and a Streamlit-based UI.\n\n### Key capabilities:\n- Multi-step reasoning via custom **planner** → **executor** → **replanner** → **finalizer** pipeline (see [`rex_flow.png`](images/rex_flow.png)).\n- Tool-agnostic design: supports GitHub code exploration today, but can be applied to any domain by swapping MCP endpoints.\n- Context-aware: uses context summarization and selective message passing to reduce token usage.\n- Observability-ready: full tracing enabled via **LangSmith** (`LANGCHAIN_TRACING_V2=true`).\n- Benchmark-ready: metrics captured for latency and token consumption.\n\n## 🧩 Architecture Overview\n\n```mermaid\nflowchart TD\n subgraph subGraph0[\"Agent State Management\"]\n        S1[\"📦 State: Task, Messages, Plan, Tools\"]\n        S3[\"📦 State: + Tool Results\"]\n        S4[\"📦 State: + Updated Plan\"]\n        S5[\"📦 State: + Final Output\"]\n  end\n subgraph subGraph1[\"MCP Tools\"]\n        T[\"🧰 MCP Tools\"]\n  end\n     A[\"👤 User Input\"] --\u003e B[\"📝 Planner Node\"]\n     B --\u003e C[\"📋 Plan Generation\"]\n     C --\u003e D[\"🧠 Summarizer Node\"]\n     D --\u003e E[\"📝 Context Summary\"]\n     E --\u003e F[\"🤖 Executor Node (React Agent)\"]\n     F --\u003e G1[\"🔧 Tool Call 1\"] \u0026 G2[\"🔧 Tool Call 2\"] \u0026 GN[\"🔧 Tool Call N\"]\n     G1 --\u003e H[\"📊 Results Collection\"]\n     G2 --\u003e H\n     GN --\u003e H\n     H --\u003e I[\"🔄 Replanner Node\"]\n     I --\u003e J[\"📝 Updated Plan\"] \u0026 K[\"✅ Finalizer Node\"]\n     J --\u003e F\n     K --\u003e L[\"💬 Final Response\"]\n     L --\u003e M[\"🏁 END\"]\n     A -.-\u003e S1\n     H -.-\u003e S3\n     I -.-\u003e S4\n     K -.-\u003e S5\n     F -.-\u003e T\n```\n\n\u003e **📋 Detailed Architecture**: For a comprehensive view of the system architecture, see [`rex_flow.png`](images/rex_flow.png).\n\n### Agent Types\n\n#### 🤖 React Agent\n- **Purpose**: Simple, fast execution for straightforward tasks\n- **Best for**: Direct tool calls, quick queries, cost-effective operations\n- **Flow**: Direct tool execution with minimal planning overhead\n\n#### 📋 Planner Agent  \n- **Purpose**: Complex multi-step reasoning and analysis\n- **Best for**: Detailed repository analysis, code exploration, comprehensive summaries\n- **Flow**: Plan → Execute → Replan → Finalize pipeline\n\n## Features\n\n- **Conversational Q\u0026A**: Chat with the system to ask questions about any GitHub repository.\n- **Multiple Agent Types**: Choose between React and Planner agents for different task complexities.\n- **MCP Tool Integration**: Access repository structure, file contents, commit history, issues/PRs, code search, and more via MCP servers.\n- **Advanced Code Analysis**: Summarize, analyze, and explain code, dependencies, and recent changes.\n- **Streamlit UI**: Clean, chat-like interface with conversation history and tool usage display.\n- **Extensible**: Easily add new MCP tools or agent types.\n- **LangSmith Tracing**: Full observability and debugging with LangSmith.\n- **Metrics**: Latency and token usage tracking for benchmarking.\n\n## 📦 Installation \u0026 Quick Start\n\n### Prerequisites\n\n- **Python 3.13+** (required by the project)\n- **Git** (for repository cloning)\n- **OpenAI API Key** (for LLM interactions)\n- **LangSmith API Key** (optional, for tracing and debugging)\n\n### Setup\n\n1. **Clone and navigate to the repository:**\n   ```sh\n   git clone \u003crepository-url\u003e\n   cd rex\n   ```\n\n2. **Set up environment variables:**\n   ```sh\n   cp .envrc.example .envrc\n   ```\n   \n   Edit `.envrc` with your API keys:\n   ```sh\n   export OPENAI_API_KEY='your_openai_api_key_here'\n   export LANGSMITH_TRACING=\"true\"\n   export LANGSMITH_ENDPOINT=\"https://api.smith.langchain.com\"\n   export LANGSMITH_API_KEY=\"your_langsmith_api_key_here\"\n   export LANGSMITH_PROJECT=\"your_project_name_here\"\n   ```\n\n3. **Load environment variables:**\n   ```sh\n   source .envrc\n   ```\n\n### Installation Options\n\n#### Option 1: Using uv (Recommended)\n\n```sh\nuv venv\nsource .venv/bin/activate\nuv pip install\n```\n\n#### Option 2: Using pip\n\n```sh\npython -m venv .venv\nsource .venv/bin/activate  # On Windows: .venv\\Scripts\\activate\npip install -r requirements.txt\n```\n\n### Run the Application\n\n```sh\nstreamlit run main.py\n```\n\nOpen your browser to `http://localhost:8501` and start exploring! Try asking: \"What is this repository about?\"\n\n## 💡 Usage\n\n- **Launch the app** and select your preferred agent in the sidebar:\n  - **React Agent**: Useful for simpler tasks, cheaper and faster\n  - **Planner Agent**: Suitable for more complex tasks requiring detailed analysis\n- **Enter your question** or task in the chat input (e.g., \"Show me all functions related to authentication\").\n- **Watch the agent work** as it analyzes the repository, calls MCP tools as needed, and responds in the chat.\n- **Review tool usage** and conversation history displayed for transparency.\n\n## 🛠️ Supported MCP Tools\n\n- **Repository Management**: Clone and manage GitHub repositories locally\n- **File Content Parser**: Retrieve and fetch contents of specific files\n- **Repository Structure**: Get directory trees and file listings\n- **Code Search**: Search for specific code patterns or functions across the repository\n- **Commit History**: Access recent commits with diffs and changes\n- **Issues \u0026 PRs**: Query recent issues and pull requests from GitHub\n\n## ❓ Example Questions\n\n- What is this repository about and what does it do?\n- Show me the main entry points of this application\n- What are the recent changes in the last 10 commits?\n- Find all functions related to authentication\n- What dependencies does this project use?\n- Are there any open issues related to performance?\n- Explain how the database connection is implemented\n- What's the testing strategy used in this project?\n\n## 🔧 Troubleshooting\n\n### Common Issues\n\n**Q: \"Module not found\" errors**\n- Ensure you're using Python 3.13+\n- Make sure you've activated your virtual environment\n- Try reinstalling dependencies: `uv pip install --force-reinstall`\n\n**Q: \"OpenAI API key not found\"**\n- Check that your `.envrc` file is properly configured\n- Ensure you've sourced the environment: `source .envrc`\n- Verify your OpenAI API key is valid and has sufficient credits\n\n**Q: \"Streamlit not found\"**\n- Install Streamlit: `pip install streamlit` or `uv pip install streamlit`\n- Ensure you're running from the project root directory\n\n**Q: \"LangSmith tracing not working\"**\n- LangSmith is optional - the app works without it\n- If you want tracing, ensure your LangSmith API key is valid\n- Check that `LANGSMITH_TRACING=\"true\"` is set in your `.envrc`\n\n## 🤝 Contributing\n\nContributions are welcome! Please open issues or pull requests for bug fixes, new features, or improvements.\n\n### Development Setup\n\n1. Fork the repository\n2. Create a feature branch: `git checkout -b feature/amazing-feature`\n3. Make your changes and test thoroughly\n4. Commit your changes: `git commit -m 'Add amazing feature'`\n5. Push to the branch: `git push origin feature/amazing-feature`\n6. Open a Pull Request\n\n## 📄 License\n\nThis project is licensed under the MIT License. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnehalyelmati%2Frex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnehalyelmati%2Frex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnehalyelmati%2Frex/lists"}