-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Feature Request: CLI Scaffold Generator for TinyAgent Projects
Overview
Add a create command to the tinyagent CLI that generates TypeScript project scaffolds aligned with our current architecture and patterns.
Proposed Command
npx tinyagent create <project_name>
# or
ta create <project_name>Generated Project Structure
my_project/
├── .gitignore
├── package.json
├── tsconfig.json
├── README.md
├── .env.example
└── src/
├── index.ts # Entry point
├── agents/
│ ├── main.agent.ts # Main agent configuration
│ └── index.ts
├── tools/
│ ├── example.tool.ts
│ └── index.ts
└── prompts/
└── system.md # System prompt (optional)
Key Features
-
Aligned with Current Patterns:
- Uses our unified
Agentclass with mode configuration - Programmatic configuration (no YAML initially)
- TypeScript-first with proper types
- Follows our tool interface patterns
- Uses our unified
-
Generated Main Agent (
src/agents/main.agent.ts):
import { Agent } from 'tinyagent-ts';
import { getDefaultTools } from 'tinyagent-ts/default-tools';
import { exampleTool } from '../tools';
export function createMainAgent() {
const agent = new Agent({
mode: 'react',
model: {
name: process.env.MODEL_NAME || 'gpt-4o-mini',
provider: 'openrouter',
apiKey: process.env.OPENROUTER_API_KEY\!
},
react: {
maxSteps: 10,
enableReflexion: true
}
});
// Register default tools
getDefaultTools().forEach(tool => agent.registerTool(tool));
// Register custom tools
agent.registerTool(exampleTool);
return agent;
}- Example Custom Tool (
src/tools/example.tool.ts):
import { Tool } from 'tinyagent-ts';
import { z } from 'zod';
export const exampleTool: Tool = {
name: 'example_tool',
description: 'An example custom tool',
schema: z.object({
input: z.string().describe('The input to process')
}),
execute: async ({ input }) => {
return `Processed: ${input}`;
}
};-
Interactive Setup:
- Ask for project type (simple chat, web scraper, data processor, custom)
- Configure default tools based on type
- Set up appropriate .env.example
-
Templates for Common Patterns:
- Web Scraper: Includes file & grep tools, example scraping logic
- Data Processor: Python execution, file tools
- Chat Agent: Simple mode, minimal tools
- Multi-Agent: Example of composing multiple agents
Benefits
- Quick start for new projects
- Promotes best practices from our codebase
- Maintains our philosophy of simplicity and explicit configuration
- TypeScript-first approach
- Easy to extend with more templates
Implementation Notes
- Extend existing CLI in
src/cli.ts - Use templates stored in
src/templates/ - Keep it simple - no complex configuration wizards
- Focus on getting users to a working agent quickly
Future Enhancements
- Add YAML/JSON configuration support (building on ConfigurableAgent work)
- Support for multi-agent crews
- More sophisticated templates
Metadata
Metadata
Assignees
Labels
No labels