App | Documentation | API Reference | Chat with π₯§ Repo
Potpie is an open-source platform that creates AI agents specialized in your codebase, enabling automated code analysis, testing, and development tasks. By building a comprehensive knowledge graph of your code, Potpie's agents can understand complex relationships and assist with everything from debugging to feature development.
- π₯§ Why Potpie?
- π€ Our Prebuilt Agents
- π οΈ Tooling
- π Getting Started
- π‘ Use Cases
- π οΈ Custom Agents
- π¨ Make Potpie Your Own
- π€ Contributing
- π License
- πͺ Contributors
- π§ Deep Code Understanding: Built-in knowledge graph captures relationships between code components
- π€ Pre-built & Custom Agents: Ready-to-use agents for common tasks + build your own
- π Seamless Integration: Works with your existing development workflow
- π Flexible: Handles codebases of any size or language
Potpie offers a suite of specialized codebase agents for automating and optimizing key aspects of software development:
- Debugging Agent: Automatically analyzes stacktraces and provides debugging steps specific to your codebase.
- Codebase Q&A Agent: Answers questions about your codebase and explains functions, features, and architecture.
- Code Changes Agent: Analyzes code changes, identifies affected APIs, and suggests improvements before merging.
- Integration Test Agent: Generates integration test plans and code for flows to ensure components work together properly.
- Unit Test Agent: Automatically creates unit test plan and code for individual functions to enhance test coverage.
- LLD Agent: Creates a low level design for implementing a new feature by providing functional requirements to this agent.
- Code Generation Agent: Generates code for new features, refactors existing code, and suggests optimizations.
Potpie provides a set of tools that agents can use to interact with the knowledge graph and the underlying infrastructure:
- get_code_from_probable_node_name: Retrieves code snippets based on a probable node name.
- get_code_from_node_id: Fetches code associated with a specific node ID.
- get_code_from_multiple_node_ids: Retrieves code snippets for multiple node IDs simultaneously.
- ask_knowledge_graph_queries: Executes vector similarity searches to obtain relevant information.
- get_nodes_from_tags: Retrieves nodes tagged with specific keywords.
- get_code_graph_from_node_id/name: Fetches code graph structures for a specific node.
- change_detection: Detects changes in the current branch compared to the default branch.
- get_code_file_structure: Retrieves the file structure of the codebase.
- Docker installed and running
- OpenAI API key
- Git installed (for repository access)
-
Prepare Your Environment
- Create a
.env
file based on the.env.template
- Add the following required configurations:
isDevelopmentMode=enabled ENV=development OPENAI_API_KEY=<your-openai-key>
- Create a
-
Start Potpie
chmod +x start.sh ./start.sh
-
Authentication Setup (Skip this step in development mode)
curl -X POST 'http://localhost:8001/api/v1/login' \ -H 'Content-Type: application/json' \ -d '{ "email": "your-email", "password": "your-password" }' # Save the bearer token from the response for subsequent requests
-
Initialize Repository Parsing
# For development mode: curl -X POST 'http://localhost:8001/api/v1/parse' \ -H 'Content-Type: application/json' \ -d '{ "repo_path": "path/to/local/repo", "branch_name": "main" }' # For production mode: curl -X POST 'http://localhost:8001/api/v1/parse' \ -H 'Content-Type: application/json' \ -d '{ "repo_name": "owner/repo-name", "branch_name": "main" }' # Save the project_id from the response
-
Monitor Parsing Status
curl -X GET 'http://localhost:8001/api/v1/parsing-status/your-project-id' # Wait until parsing is complete
-
View Available Agents
curl -X GET 'http://localhost:8001/api/v1/list-available-agents/?list_system_agents=true' # Note down the agent_id you want to use
-
Create a Conversation
curl -X POST 'http://localhost:8001/api/v1/conversations/' \ -H 'Content-Type: application/json' \ -d '{ "user_id": "your_user_id", "title": "My First Conversation", "status": "active", "project_ids": ["your-project-id"], "agent_ids": ["chosen-agent-id"] }' # Save the conversation_id from the response
-
Start Interacting with Your Agent
curl -X POST 'http://localhost:8001/api/v1/conversations/your-conversation-id/message/' \ -H 'Content-Type: application/json' \ -d '{ "content": "Your question or request here" }'
-
View Conversation History (Optional)
curl -X GET 'http://localhost:8001/api/v1/conversations/your-conversation-id/messages/?start=0&limit=10'
- Onboarding: For developers new to a codebase, the codebase QnA agent helps them understand the codebase and get up to speed quickly. Ask it how to setup a new project, how to run the tests etc
We tried to onboard ourselves with Potpie to the AgentOps codebase and it worked like a charm : Video here.
- Codebase Understanding: Answer questions about any library you're integrating, explain functions, features, and architecture.
We used the Q&A agent to understand the underlying working of a feature of the CrewAI codebase that was not documented in official docs : Video here.
- Low Level Design: Get detailed implementation plans for new features or improvements before writing code.
We fed an open issue from the Portkey-AI/Gateway project to this agent to generate a low level design for it: Video here.
- Reviewing Code Changes: Understand the functional impact of changes and compute the blast radius of modifications.
Here we analyse a PR from the mem0ai/mem0 codebase and understand its blast radius : Video here.
-
Debugging: Get step-by-step debugging guidance based on stacktraces and codebase context.
-
Testing: Generate contextually aware unit and integration test plans and test code that understand your codebase's structure and purpose.
π οΈ Custom Agents Upgrade β¨
With Custom Agents, you can design personalized tools that handle repeatable tasks with precision. Key components include:
- System Instructions: Define the agent's task, goal, and expected output
- Agent Information: Metadata about the agent's role and context
- Tasks: Individual steps for job completion
- Tools: Functions for querying the knowledge graph or retrieving code
Potpie is designed to be flexible and customizable. Here are key areas to personalize your own deployment:
Modify prompts in app/modules/intelligence/prompts/system_prompt_setup.py
Create new agents in app/modules/intelligence/agents/chat_agents
and app/modules/intelligence/agents/agentic_tools
Modify guidelines within each agent's prompt in the app/modules/intelligence/agents
directory
Edit or add tools in the app/modules/intelligence/tools
directory
We welcome contributions! To contribute:
- Fork the repository
- Create a new branch (
git checkout -b feature-branch
) - Make your changes
- Commit (
git commit -m 'Add new feature'
) - Push to the branch (
git push origin feature-branch
) - Open a Pull Request
See Contributing Guide for more details.
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
Thanks for spending your time helping build Potpie. Keep rocking π₯