Heads up!
agentic-terminal-workbench
Composio Agent CLI
A TypeScript CLI for chatting with OpenAI models and optionally running Composio toolkits through the OpenAI Agents SDK. It ships a lightweight ChatGPT-compatible API wrapper, streaming support, and a CLI with interactive mode.
Highlights
- CLI for direct chat or interactive sessions.
- Optional Composio toolkits with a dedicated agent runner.
- Streaming support for standard OpenAI chat completions.
- Minimal, typed API wrapper for programmatic use.
- Sensible defaults with overrides for model, timeouts, and prompts.
Requirements
- Node.js v18+
- An OpenAI API key
- Optional: a Composio API key for toolkits
Installation
This repo is set up for local development and direct CLI usage from source.
bun install
Quickstart
CLI (from source)
Standard OpenAI chat:
OPENAI_API_KEY=... bun run cli -- "What came first, the chicken or the egg?"
Interactive mode:
OPENAI_API_KEY=... bun run cli
With Composio toolkits:
OPENAI_API_KEY=... COMPOSIO_API_KEY=... bun run cli --toolkits github,gmail "List my unread emails"
Note: streaming is not supported when toolkits are enabled (the CLI will warn you).
Programmatic usage
import { ChatGPTAPI } from "composio-agent";
const api = new ChatGPTAPI({
apiKey: process.env.OPENAI_API_KEY!,
model: "gpt-4o",
});
const res = await api.sendMessage("Write a concise summary of Composio.");
console.log(res.text);
Configuration
The CLI loads environment variables via dotenv.
OPENAI_API_KEY(required) - API key for OpenAI.COMPOSIO_API_KEY(optional) - Required when using--toolkits.COMPOSIO_USER_ID(optional) - Overrides the default user ID.COMPOSIO_CLI_DEBUG=1(optional) - Verbose interactive lifecycle logs.
You can also pass --apiKey directly to the CLI, or use --model to override the model for a session.
CLI reference
Basic usage:
npm run cli -- [prompt]
Options:
-k, --apiKey <apiKey>- OpenAI API key.-m, --model <model>- Model to use (e.g.gpt-4o).-t, --timeout <timeout>- Timeout in milliseconds.-s, --stream- Enable streaming (default: true).--toolkits <toolkits>- Comma-separated toolkits to load (Composio mode).
Interactive slash commands:
/help- Show help./model <name>- Change model./model list- Show current model./toolkits <list>- Change toolkits (Composio mode only)./toolkits list- Show active toolkits./clear- Clear the screen./quitor/exit- Exit.
How Composio mode works
When --toolkits is provided, the CLI initializes a Composio session, loads the selected toolkits, and runs an agent using the OpenAI Agents SDK. The agent executes tools internally and returns the final response. Streaming is not available in this mode due to SDK limitations.
Development
Build and watch:
bun run dev
Build for release:
bun run build
Generate docs:
bun run docs
Run tests (format check):
bun run test
Project structure
src/
chatgpt-api.ts OpenAI chat completion wrapper
cli.ts CLI entrypoint
composio-agent.ts Composio agent integration
fetch.ts Fetch helper
fetch-sse.ts SSE streaming helper
stream-async-iterable.ts
types.ts Shared types
utils.ts Model utilities
Contributing
Issues and PRs are welcome. Please keep changes focused and add clear reproduction steps for bugs.
License
MIT - see LICENSE.