Overview
This demo shows how to build an AI agent using the Claude Agent SDK that clones any public GitHub repo and uses Claude to answer questions about its codebase. The agent explores the code usingGrep and Read tools to provide detailed, accurate answers.
Tech stack
- Next.js – React framework with App Router for the frontend
- Claude Agent SDK – Anthropic’s SDK for building AI agents with file system and search tools
- Trigger.dev – workflow orchestration with real-time streaming, observability, and deployment
Demo video
GitHub repo
View the Claude GitHub wiki agent repo
Click here to view the full code for this project in our examples repository on GitHub. You can
fork it and use it as a starting point for your own project.
How it works
The agent workflow:- Receive question – User provides a GitHub URL and question about the repo
- Clone repository – Shallow clone to a temp directory (depth=1 for speed)
- Analyze with Claude – Agent explores the codebase using allowed tools:
Grep– Search for patterns across filesRead– Read file contents
- Stream response – Analysis streams to the frontend in real-time
- Cleanup – Temp directory is always deleted, even on failure
Features
- Ask anything about any public repo – Architecture, security vulnerabilities, API endpoints, testing strategies, etc.
- Claude Agent SDK exploration – Claude explores the codebase using
GrepandReadtools - Cancel anytime – Abort long-running tasks with proper cleanup
- Trigger.dev Realtime streaming – Watch Claude’s analysis stream in as it’s generated
- Progress tracking – See clone status, analysis progress, and repo size via Trigger.dev metadata
Relevant code
| File | Description |
|---|---|
trigger/analyze-repo.ts | Main task that clones repo, runs Claude agent, and streams response |
trigger/agent-stream.ts | Typed stream definition for real-time text responses |
app/api/analyze-repo/route.ts | API endpoint that triggers the task |
app/response/[runId]/page.tsx | Real-time streaming display with progress |
trigger.config.ts
You need to mark the Claude Agent SDK as external in your trigger.config.ts file.trigger.config.ts
Adding packages to
external prevents them from being bundled, which is necessary for the Claude
Agent SDK. See the build configuration docs for more details.Learn more
- Building agents with Claude Agent SDK – Comprehensive guide for using Claude Agent SDK with Trigger.dev
- Trigger.dev Realtime – Stream task progress to your frontend
- Errors and retrying – Handle failures gracefully

