You are a coding agent working inside an existing Next.js repository.
Context We are dogfooding Composio Tool Router, which has moved from experimental mode into the stable release. Tool Router is a unified interface that lets an agent search, authenticate, and execute actions across many tools, and sessions are ephemeral and user-scoped. Use it via MCP sessions and handle auth gracefully. Keep this work isolated from the main Kanban product features.
Goal Add a small “Labs” eval harness that demonstrates a Tool Router powered agent for GitHub issue triage.
Where to put it
- UI page: /labs/triage (App Router)
- API route: /api/labs/triage
- Keep any helpers under something like src/lib/composio or src/lib/labs so it is clearly non-product code.
Hard constraints
- Install any required dependencies like
@composio/coreor any that you require. - Restrict Tool Router to the GitHub toolkit only.
- Do not store long-lived MCP session URLs in the browser. Create sessions server-side per run.
- Auth must be user-friendly: if GitHub is not connected, return an auth URL and show it in the UI so the user can connect and rerun.
- Minimal, production-quality code, but clearly labeled as “Labs” or “Eval” so it does not feel like random product scope creep.
UI requirements Create a simple page with:
- repo input (owner/repo)
- issue title input
- bug report textarea
- “Run triage” button
- output panel that shows:
- status (searching, auth required, created, duplicate found)
- final GitHub URL (issue link)
- a short action log
Agent behavior When the user clicks Run:
- Search the repo for similar open issues based on the title and bug report.
- If a likely duplicate exists:
- comment on that issue with the new report
- return the duplicate issue URL
- Otherwise:
- create a new issue with a clean title and structured body
- apply label “triage” (create it if missing)
- return the new issue URL
Implementation notes
- Use Composio Tool Router to create an MCP session for a userId and restrict toolkits to ["github"].
- If the agent hits an auth requirement, surface the auth URL in the API response and UI.
- Log the key steps to the UI output so this is easy to demo and screenshot.
Finish requirements
- Add a short docs note in docs/labs-triage.md explaining:
- required env var: COMPOSIO_API_KEY
- how to run the page locally
- what the auth flow looks like
- Run npm run lint and npm run build and fix failures.
- End by listing: files changed, commands run, and how to manually verify end-to-end.