Heads up!
all-in-one-agent
Codev Agent
An all-in-one AI-powered built with Next.js and Composio Tool Router. This application enables intelligent automation across 1000+ tools for any tasks like processing refunds, checking orders, creating tickets, and pretty much everything.
Built by Shrijal Acharya (@shricodev)
Features
- Dynamic Tool Discovery: Uses Composio Tool Router to search and discover the right tools at runtime
- In-Chat Authentication: Seamlessly handles OAuth flows when tools require authentication
- Real-time Activity Panel: See exactly what the agent is doing with tool calls, status updates, and results
- Multi-turn Conversations: Maintains context across multiple messages
- Beautiful Onboarding: Guided setup with toolkit selection and authentication
- Support-focused Behavior: Confirmation gates for destructive actions, handoff to human support
Architecture
├── app/
│ ├── api/
│ │ ├── session/ # Composio session management
│ │ ├── toolkits/ # List and manage toolkits
│ │ ├── auth/ # Manual authentication flow
│ │ └── chat/ # SSE endpoint for agent chat
│ ├── onboarding/ # Setup wizard
│ ├── console/ # Main chat interface
│ └── page.tsx # Entry point routing
├── components/
│ ├── ui/ # Base UI components
│ ├── toolkit-card.tsx # Toolkit selection cards
│ ├── chat-message.tsx # Chat message rendering
│ ├── tool-call-card.tsx # Tool call display
│ └── activity-panel.tsx # Agent activity timeline
├── hooks/
│ ├── use-chat.ts # Chat SSE hook
│ └── use-toolkits.ts # Toolkit management hook
└── lib/
├── types.ts # TypeScript types
├── schemas.ts # Zod validation schemas
├── utils.ts # Utility functions
├── composio.ts # Composio integration
└── agent.ts # OpenAI Agent runner
Prerequisites
- Node.js 18+
- npm or yarn
- Composio API Key
- OpenAI API Key
Setup
- Clone and install dependencies
cd all-in-one-agent-composio
npm install
- Configure environment variables
cp .env.example .env.local
Edit .env.local with your API keys:
COMPOSIO_API_KEY=your_composio_api_key
OPENAI_API_KEY=your_openai_api_key
OPENAI_MODEL=gpt-5.2
DEFAULT_USER_ID=default_user
NEXT_PUBLIC_DEFAULT_USER_ID=default_user
- Run the development server
npm run dev
- Open the app
Navigate to http://localhost:3000
Usage
Onboarding
- Welcome: Learn about the agent's capabilities
- Select Toolkits: Choose which tools to connect (Gmail, Slack, Stripe, etc.)
- Connect Accounts: Authenticate each selected toolkit
- Finish: Start using the support console
Support Console
The main interface has two panels:
- Left: Chat with the AI agent
- Right: Activity panel showing tool calls and their results
Demo Prompts
Try these example prompts:
"Create a support ticket for a billing issue and notify the team on Slack"
"Summarize today's support tickets in this github repository: <repo_link>"
Authentication Flow
When the agent needs to use a tool that requires authentication:
- The agent will indicate authentication is needed
- A Connect Link URL will be provided
- Click the link to authenticate in a new window
- Return to the chat and continue your conversation
- The agent will automatically retry the action
Configuration
Model Selection
Configure the OpenAI model in .env.local:
OPENAI_MODEL=gpt-5.2
# OPENAI_MODEL=gpt-4.1
# OPENAI_MODEL=gpt-4o
User Management
- Session creation:
composio.create(userId) - Chat API:
POST /api/chat { userId, message } - Toolkit API:
GET /api/toolkits?userId=... - Auth API:
POST /api/auth { userId, toolkit }
Toolkit Configuration
By default, all toolkits are available. To restrict to specific toolkits, modify lib/composio.ts:
const session = await composio.create(userId, {
toolkits: ["gmail", "slack", "stripe", "zendesk"],
});
How It Works
Composio Tool Router
Tool Router provides a unified interface for the agent to:
- Search for relevant tools based on the user's request
- Plan multi-step actions across different services
- Authenticate users via Connect Links when needed
- Execute actions and return results
The agent doesn't hardcode specific tool integrations. Instead, it dynamically discovers the right tools at runtime.
MCP Integration
The application uses Composio's hosted MCP (Model Context Protocol) server:
const session = await composio.create(userId);
const agent = new Agent({
tools: [
hostedMcpTool({
serverLabel: "composio",
serverUrl: session.mcp.url,
headers: session.mcp.headers,
}),
],
});
SSE Streaming
The chat API uses Server-Sent Events for real-time updates:
connected: Connection establishedactivity_start/update/complete: Agent activity updatestool_call_start/complete: Tool execution statusmessage_start/delta/complete: Streaming message contentauth_required: Authentication needederror: Error occurreddone: Request complete
Development
Project Structure
- TypeScript: Full type safety throughout
- Zod: Runtime validation for API requests/responses
- Next.js App Router: Server components and API routes
- Tailwind CSS: Utility-first styling
- Lucide Icons: Beautiful icon set