Skip to main content
The Codebase Q&A Agent answers questions about your codebase by navigating the knowledge graph to find relevant code, trace dependencies, and return cited answers. Before the agent runs, it prepares two pieces of context automatically. If specific nodes are referenced in the query, it fetches their source code and appends it as code context. It also fetches the full file structure of the project. Both are injected into context before the agent processes your message.

How It Works

Understand the Question

The agent classifies every incoming question into one of four types:
  • What covers functionality and purpose
  • How covers implementation and flow
  • Where covers location and usage sites
  • Why covers rationale and design decisions
It extracts key entities such as class names, function names, and modules to determine scope.
For complex or multi-part questions, the agent tracks what needs answering and breaks exploration into individual tasks before any navigation begins.
The agent moves from broad to narrow, starting by finding where relevant functionality lives in the knowledge graph. It then understands directory layout and module organization, retrieves specific named classes or functions, and batch-fetches all relevant nodes collected so far. From there it maps what calls the code and what the code calls, retrieving full files or specific line ranges as needed, and reading multiple files simultaneously when broad context is required. It also searches file contents directly by pattern to locate usage sites and definitions not reachable through the graph alone. If the question involves a third-party library, the agent retrieves external documentation to supplement its answer when required.

Respond

Answers are structured using clear section headings such as Main Answer, Details, Code Examples, and Related Components. They are grounded in the codebase with file path and line number citations where relevant, and all code snippets are presented in fenced blocks with appropriate language tags for clarity. Before returning, the agent verifies that all aspects of the question are answered and all exploration tasks are complete.

Calling the Agent

curl -X POST http://localhost:8001/api/v2/conversations/ \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "project_ids": ["proj_abc123"],
    "agent_ids": ["codebase_qna_agent"]
  }'
Once you have a conversation_id, send your question:
curl -X POST http://localhost:8001/api/v2/conversations/conv_xyz789/message/ \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "How is authentication implemented?"
  }'

Next Steps