create-adk-agent 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/README.md +198 -0
  2. package/dist/generators/init/generator.js +87 -0
  3. package/dist/generators/init/generator.js.map +1 -0
  4. package/dist/generators/init/schema.d.js +3 -0
  5. package/dist/generators/init/schema.d.js.map +1 -0
  6. package/dist/index.js +3 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/lib/create-adk-agent.js +5 -0
  9. package/dist/lib/create-adk-agent.js.map +1 -0
  10. package/generators.json +10 -0
  11. package/package.json +73 -0
  12. package/src/generators/init/files/.env.example.template +16 -0
  13. package/src/generators/init/files/.eslintrc.json.template +20 -0
  14. package/src/generators/init/files/.gitignore.template +27 -0
  15. package/src/generators/init/files/.prettierrc.template +7 -0
  16. package/src/generators/init/files/README.md.template +242 -0
  17. package/src/generators/init/files/jest.config.ts.template +7 -0
  18. package/src/generators/init/files/package.json.template +39 -0
  19. package/src/generators/init/files/src/agents/basic/agent.ts.template +34 -0
  20. package/src/generators/init/files/src/agents/multi-tool/agent.ts.template +83 -0
  21. package/src/generators/init/files/src/agents/streaming/agent.ts.template +36 -0
  22. package/src/generators/init/files/src/agents/team/farewell-agent.ts.template +43 -0
  23. package/src/generators/init/files/src/agents/team/greeting-agent.ts.template +43 -0
  24. package/src/generators/init/files/src/agents/team/root-agent.ts.template +18 -0
  25. package/src/generators/init/files/src/agents/workflow/agent.ts.template +69 -0
  26. package/src/generators/init/files/src/index.ts.template +61 -0
  27. package/src/generators/init/files/tests/agents.test.ts.template +80 -0
  28. package/src/generators/init/files/tsconfig.json.template +20 -0
  29. package/src/generators/init/schema.json +124 -0
@@ -0,0 +1,61 @@
1
+ import 'dotenv/config';
2
+ <% if (hasBasic) { %>import { rootAgent as basicAgent } from './agents/basic/agent.js';
3
+ <% } %><% if (hasMultiTool) { %>import { rootAgent as multiToolAgent } from './agents/multi-tool/agent.js';
4
+ <% } %><% if (hasTeam) { %>import { rootAgent as teamAgent } from './agents/team/root-agent.js';
5
+ <% } %><% if (hasStreaming) { %>import { rootAgent as streamingAgent } from './agents/streaming/agent.js';
6
+ <% } %><% if (hasWorkflow) { %>import { rootAgent as workflowAgent } from './agents/workflow/agent.js';
7
+ <% } %>
8
+ // Validate required environment variables based on model
9
+ const modelProvider = '<%= modelProvider %>';
10
+ const model = '<%= model %>';
11
+
12
+ if (modelProvider === 'gemini' && !process.env.GEMINI_API_KEY) {
13
+ console.error('❌ GEMINI_API_KEY is required for Gemini models.');
14
+ console.error('Get your API key from: https://aistudio.google.com/apikey');
15
+ console.error('Add it to your .env file: GEMINI_API_KEY=your_key_here');
16
+ process.exit(1);
17
+ }
18
+
19
+ if (modelProvider === 'openai' && !process.env.OPENAI_API_KEY) {
20
+ console.error('❌ OPENAI_API_KEY is required for OpenAI models.');
21
+ console.error('Get your API key from: https://platform.openai.com/api-keys');
22
+ console.error('Add it to your .env file: OPENAI_API_KEY=your_key_here');
23
+ process.exit(1);
24
+ }
25
+
26
+ if (modelProvider === 'anthropic' && !process.env.ANTHROPIC_API_KEY) {
27
+ console.error('❌ ANTHROPIC_API_KEY is required for Anthropic models.');
28
+ console.error('Get your API key from: https://console.anthropic.com/settings/keys');
29
+ console.error('Add it to your .env file: ANTHROPIC_API_KEY=your_key_here');
30
+ process.exit(1);
31
+ }
32
+
33
+ console.log('✅ Environment configured successfully');
34
+ console.log(`📦 Model Provider: ${modelProvider}`);
35
+ console.log(`🤖 Model: ${model}`);
36
+ console.log('');
37
+ console.log('Available agents:');
38
+ <% if (hasBasic) { %>console.log(' - basicAgent: Basic agent with time tool');
39
+ <% } %><% if (hasMultiTool) { %>console.log(' - multiToolAgent: Agent with multiple tools');
40
+ <% } %><% if (hasTeam) { %>console.log(' - teamAgent: Multi-agent team coordination');
41
+ <% } %><% if (hasStreaming) { %>console.log(' - streamingAgent: Streaming responses with Live API');
42
+ <% } %><% if (hasWorkflow) { %>console.log(' - workflowAgent: Workflow patterns (sequential/loop/parallel)');
43
+ <% } %>console.log('');
44
+ console.log('Run agents with ADK DevTools:');
45
+ console.log(' npm run adk:web - Web UI for all agents');
46
+ console.log(' npm run adk:run - CLI runner');
47
+
48
+ // Export agents for ADK DevTools
49
+ <% if (hasBasic) { %>export { basicAgent };
50
+ <% } %><% if (hasMultiTool) { %>export { multiToolAgent };
51
+ <% } %><% if (hasTeam) { %>export { teamAgent };
52
+ <% } %><% if (hasStreaming) { %>export { streamingAgent };
53
+ <% } %><% if (hasWorkflow) { %>export { workflowAgent };
54
+ <% } %>
55
+ // Default export for convenience
56
+ <% if (hasMultiTool) { %>export default multiToolAgent;
57
+ <% } else if (hasBasic) { %>export default basicAgent;
58
+ <% } else if (hasTeam) { %>export default teamAgent;
59
+ <% } else if (hasStreaming) { %>export default streamingAgent;
60
+ <% } else if (hasWorkflow) { %>export default workflowAgent;
61
+ <% } %>
@@ -0,0 +1,80 @@
1
+ <% if (hasBasic) { %>import { rootAgent as basicAgent } from '../src/agents/basic/agent.js';
2
+
3
+ describe('Basic Agent', () => {
4
+ it('should initialize with correct configuration', () => {
5
+ expect(basicAgent.name).toBe('hello_time_agent');
6
+ expect(basicAgent.tools).toHaveLength(1);
7
+ expect(basicAgent.tools[0].name).toBe('get_current_time');
8
+ });
9
+
10
+ it('should have correct description', () => {
11
+ expect(basicAgent.description).toContain('time');
12
+ });
13
+ });
14
+ <% } %>
15
+ <% if (hasMultiTool) { %>import { rootAgent as multiToolAgent } from '../src/agents/multi-tool/agent.js';
16
+
17
+ describe('Multi-Tool Agent', () => {
18
+ it('should initialize with correct configuration', () => {
19
+ expect(multiToolAgent.name).toBe('multi_tool_agent');
20
+ expect(multiToolAgent.tools).toHaveLength(3);
21
+ });
22
+
23
+ it('should have time, weather, and calculate tools', () => {
24
+ const toolNames = multiToolAgent.tools.map((tool) => tool.name);
25
+ expect(toolNames).toContain('get_current_time');
26
+ expect(toolNames).toContain('get_weather');
27
+ expect(toolNames).toContain('calculate');
28
+ });
29
+ });
30
+ <% } %>
31
+ <% if (hasTeam) { %>import { rootAgent as teamAgent } from '../src/agents/team/root-agent.js';
32
+ import { greetingAgent } from '../src/agents/team/greeting-agent.js';
33
+ import { farewellAgent } from '../src/agents/team/farewell-agent.js';
34
+
35
+ describe('Team Agents', () => {
36
+ it('root agent should coordinate sub-agents', () => {
37
+ expect(teamAgent.name).toBe('team_root_agent');
38
+ expect(teamAgent.agents).toHaveLength(2);
39
+ });
40
+
41
+ it('greeting agent should have say_hello tool', () => {
42
+ expect(greetingAgent.name).toBe('greeting_agent');
43
+ expect(greetingAgent.tools).toHaveLength(1);
44
+ expect(greetingAgent.tools[0].name).toBe('say_hello');
45
+ });
46
+
47
+ it('farewell agent should have say_goodbye tool', () => {
48
+ expect(farewellAgent.name).toBe('farewell_agent');
49
+ expect(farewellAgent.tools).toHaveLength(1);
50
+ expect(farewellAgent.tools[0].name).toBe('say_goodbye');
51
+ });
52
+ });
53
+ <% } %>
54
+ <% if (hasStreaming) { %>import { rootAgent as streamingAgent } from '../src/agents/streaming/agent.js';
55
+
56
+ describe('Streaming Agent', () => {
57
+ it('should initialize with correct configuration', () => {
58
+ expect(streamingAgent.name).toBe('streaming_agent');
59
+ expect(streamingAgent.tools).toHaveLength(1);
60
+ });
61
+
62
+ it('should have process_data tool', () => {
63
+ expect(streamingAgent.tools[0].name).toBe('process_data');
64
+ });
65
+ });
66
+ <% } %>
67
+ <% if (hasWorkflow) { %>import { rootAgent as workflowAgent } from '../src/agents/workflow/agent.js';
68
+
69
+ describe('Workflow Agent', () => {
70
+ it('should initialize with correct configuration', () => {
71
+ expect(workflowAgent.name).toBe('workflow_agent');
72
+ expect(workflowAgent.tools).toHaveLength(3);
73
+ });
74
+
75
+ it('should have workflow tools in correct order', () => {
76
+ const toolNames = workflowAgent.tools.map((tool) => tool.name);
77
+ expect(toolNames).toEqual(['validate_input', 'transform_data', 'save_result']);
78
+ });
79
+ });
80
+ <% } %>
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "verbatimModuleSyntax": false,
7
+ "strict": true,
8
+ "esModuleInterop": true,
9
+ "skipLibCheck": true,
10
+ "outDir": "dist",
11
+ "rootDir": "src",
12
+ "declaration": true,
13
+ "declarationMap": true,
14
+ "sourceMap": true,
15
+ "resolveJsonModule": true,
16
+ "allowSyntheticDefaultImports": true
17
+ },
18
+ "include": ["src/**/*"],
19
+ "exclude": ["node_modules", "dist", "**/*.test.ts"]
20
+ }
@@ -0,0 +1,124 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "CreateAdkAgent",
4
+ "title": "Create ADK Agent",
5
+ "type": "object",
6
+ "properties": {
7
+ "name": {
8
+ "type": "string",
9
+ "description": "The name of the agent project",
10
+ "$default": {
11
+ "$source": "argv",
12
+ "index": 0
13
+ },
14
+ "x-prompt": "What is the name of your agent project?"
15
+ },
16
+ "directory": {
17
+ "type": "string",
18
+ "description": "Directory where the project will be created",
19
+ "default": ""
20
+ },
21
+ "description": {
22
+ "type": "string",
23
+ "description": "Project description",
24
+ "default": "My ADK Agent"
25
+ },
26
+ "templates": {
27
+ "type": "array",
28
+ "description": "Agent templates to include",
29
+ "items": {
30
+ "type": "string",
31
+ "enum": [
32
+ "basic",
33
+ "multi-tool",
34
+ "team",
35
+ "streaming",
36
+ "workflow"
37
+ ]
38
+ },
39
+ "default": [
40
+ "multi-tool"
41
+ ],
42
+ "x-prompt": {
43
+ "message": "Select agent templates to include:",
44
+ "type": "list",
45
+ "multiselect": true,
46
+ "items": [
47
+ {
48
+ "value": "basic",
49
+ "label": "Basic Agent (getCurrentTime - from docs quickstart)"
50
+ },
51
+ {
52
+ "value": "multi-tool",
53
+ "label": "Multi-tool Agent (weather + time - from docs quickstart)"
54
+ },
55
+ {
56
+ "value": "team",
57
+ "label": "Agent Team (greeting + farewell + weather delegation)"
58
+ },
59
+ {
60
+ "value": "streaming",
61
+ "label": "Streaming Agent (Live API voice/text)"
62
+ },
63
+ {
64
+ "value": "workflow",
65
+ "label": "Workflow Agent (Sequential/Loop/Parallel)"
66
+ }
67
+ ]
68
+ }
69
+ },
70
+ "modelProvider": {
71
+ "type": "string",
72
+ "description": "LLM model provider",
73
+ "enum": [
74
+ "gemini",
75
+ "openai",
76
+ "anthropic",
77
+ "custom"
78
+ ],
79
+ "default": "gemini",
80
+ "x-prompt": {
81
+ "message": "Select your preferred model provider:",
82
+ "type": "list",
83
+ "items": [
84
+ {
85
+ "value": "gemini",
86
+ "label": "Google Gemini (Google AI Studio or Vertex AI)"
87
+ },
88
+ {
89
+ "value": "openai",
90
+ "label": "OpenAI (GPT models via LiteLLM)"
91
+ },
92
+ {
93
+ "value": "anthropic",
94
+ "label": "Anthropic (Claude models via LiteLLM)"
95
+ },
96
+ {
97
+ "value": "custom",
98
+ "label": "Other/Custom (Manual configuration)"
99
+ }
100
+ ]
101
+ }
102
+ },
103
+ "model": {
104
+ "type": "string",
105
+ "description": "Specific model to use",
106
+ "default": "gemini-3.0-flash"
107
+ },
108
+ "installDependencies": {
109
+ "type": "boolean",
110
+ "description": "Install dependencies after generation",
111
+ "default": true,
112
+ "x-prompt": "Install dependencies now?"
113
+ },
114
+ "initGit": {
115
+ "type": "boolean",
116
+ "description": "Initialize git repository",
117
+ "default": true,
118
+ "x-prompt": "Initialize git repository?"
119
+ }
120
+ },
121
+ "required": [
122
+ "name"
123
+ ]
124
+ }