Skip to content

Commit 07fe835

Browse files
committed
feat(cli): implement template registry and overhaul lifecycle docs
Introduces the **Template Registry** system to the `agk` CLI, enabling dynamic template management beyond built-ins. Key Changes: - Refactored `agk init`: Now seamlessly resolves templates from the official registry or custom URLs alongside built-ins. - New Commands: Added `agk template list`, `add`, and `remove` for managing local template caches. - Documentation: Completely rewrote READMEs to align with the "Complete Lifecycle" vision (Create, Distribute, Deploy, Trace). Added `docs/creating-templates.md`. - Cleanup: Standardized documentation format across `agk` and `agenticgokit`, removing inconsistent emojis and aligning roadmap status (e.g., SubWorkflows, MCP).
1 parent 39ac01f commit 07fe835

23 files changed

Lines changed: 1399 additions & 675 deletions

README.md

Lines changed: 64 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,41 @@
11
# AGK - AgenticGoKit CLI
22

3-
> **Build production-ready agentic AI systems in seconds.**
3+
> **The Unified Toolchain for Agentic AI Systems**
44
5-
AGK is the official CLI for **AgenticGoKit**, designed to accelerate your development workflow. From scaffolding simple agents to deploying enterprise-grade multi-agent swarms, AGK handles the boilerplate so you can focus on intelligence.
5+
AGK is the official CLI for **AgenticGoKit**, designed to manage the entire lifecycle of intelligent agents. From scaffolding new projects to distributing templates and observing production workflows, AGK provides a standardized interface for building the next generation of AI software.
66

77
![Version](https://img.shields.io/badge/version-0.1.0-blue)
88
![License](https://img.shields.io/badge/license-Apache%202.0-green)
99
![Status](https://img.shields.io/badge/status-Active%20Development-yellow)
1010

1111
---
1212

13-
## 🚀 Why AGK?
13+
## Vision: The Complete Lifecycle
1414

15-
- **⚡ Instant Scaffolding**: Generate complete, compilable projects with one command.
16-
- **🧠 Smart Defaults**: Auto-detects configuration for OpenAI, Anthropic, and Ollama.
17-
- **� Trace Auditor**: Built-in observability to debug agent thoughts and prompts.
18-
- **📦 Production Ready**: Docker support, idiomatic Go code, and established patterns.
19-
- **🌊 Streaming Native**: All templates support real-time token streaming out of the box.
15+
AGK aims to streamline the developer experience across four key pillars:
16+
17+
1. **Create**: Scaffold powerful agents instantly using a rich registry of templates.
18+
2. **Distribute**: (Planned) Share your agent architectures and workflows with the community or your team.
19+
3. **Deploy**: (Planned) Seamlessly ship agents to cloud platforms, Kubernetes, or edge devices.
20+
4. **Trace**: Gain deep observability into your agent's reasoning, prompts, and performance.
2021

2122
---
2223

23-
## 🏁 Quick Start
24+
## Quick Start
2425

2526
### 1. Installation
2627

2728
```bash
2829
# Build from source
29-
cd agk-new
30+
cd agk
3031
go build -o agk main.go
3132
```
3233

3334
### 2. Create Your First Agent
3435

3536
```bash
36-
# Initialize a new project with the single-agent template
37-
./agk init my-agent --template single-agent --llm openai
37+
# Initialize a new project with the quickstart template
38+
./agk init my-agent --template quickstart --llm openai
3839

3940
# Navigate to the project
4041
cd my-agent
@@ -55,21 +56,43 @@ go run main.go
5556

5657
---
5758

58-
## 📦 Templates
59+
## Templates & Registry
60+
61+
AGK features a powerful template system that lets you use both built-in and community-created templates. Explore the [Official Template Registry](https://github.com/agk-templates).
62+
63+
### Use a Template
64+
```bash
65+
./agk init enterprise-bot --template workflow --llm anthropic
66+
```
67+
68+
### Manage Templates
69+
Bring in templates from GitHub, local folders, or other sources.
70+
71+
```bash
72+
# List all available templates (built-in + cached)
73+
agk template list
74+
75+
# Add a template from a remote source
76+
agk template add github.com/username/my-template
77+
78+
# Remove a cached template
79+
agk template remove my-template
80+
```
81+
82+
> **Want to build your own?** Check out the [Creating Templates Guide](docs/creating-templates.md).
5983
60-
Choose the right foundation for your project:
84+
### Built-in Templates
6185

62-
| Template | Complexity | Best For | Description |
63-
|----------|------------|----------|-------------|
64-
| **Quickstart** || Learning | Minimal setup. Single file. Hardcoded config. Perfect for understanding the basics. |
65-
| **Single-Agent** | ⭐⭐ | Prototypes | Adds tools, memory, and environment config. The "standard" starting point. |
66-
| **Multi-Agent** | ⭐⭐⭐ | Workflows | Sequential pipeline of specialized agents (e.g., Researcher → Writer). |
67-
| **Config-Driven** | ⭐⭐⭐⭐ | Enterprise | Factory patterns, TOML config, shared memory. Built for scale. |
68-
| **Advanced** | ⭐⭐⭐⭐⭐ | Production | Full-stack: REST API, WebSocket, Docker, Frontend integration. |
86+
| Template | Best For | Description |
87+
|----------|----------|-------------|
88+
| **Quickstart** | Learning | Minimal setup. Single file. Hardcoded config. Perfect for understanding the basics. |
89+
| **Workflow** | Pipelines | Multi-step workflow (e.g. Sequential, Parallel) structure. |
90+
91+
Run `agk init --list` to see all available templates including those from the registry.
6992

7093
**Example usage:**
7194
```bash
72-
./agk init enterprise-bot --template config-driven --llm anthropic
95+
./agk init enterprise-bot --template workflow --llm anthropic
7396
```
7497

7598
---
@@ -131,23 +154,25 @@ agk trace mermaid > trace_flow.md
131154

132155
---
133156

134-
## 🗺️ Roadmap
135-
136-
### ✅ Completed
137-
- Template system (Quickstart, Single-Agent)
138-
- Smart LLM Provider detection
139-
- Streaming support
140-
- **Trace Auditor** (Audit & Mermaid commands)
141-
- **Interactive Trace Viewer** (with content inspection)
142-
143-
### 🚧 In Progress
144-
- Multi-Agent & Enterprise templates
145-
- Advanced full-stack template
146-
147-
### 📅 Planned
148-
- Interactive init wizard (`agk init -i`)
149-
- MCP Server management
150-
- Project upgrade tools
157+
## Roadmap
158+
159+
### Completed
160+
- **Template Registry System** (`list`, `add`, `remove`)
161+
- **Smart Scaffolding** (Quickstart, Workflow bases)
162+
- **Trace Auditor** (Interactive TUI & Mermaid export)
163+
- **Streaming Support** (Native across all templates)
164+
165+
### In Progress
166+
- **Multi-Agent Templates**
167+
- **Advanced Full-Stack Templates**
168+
169+
### Planned
170+
- **Template Distribution** (`pack`, `push`)
171+
- **Cloud Deployment Engine** (`agk deploy`)
172+
- **Workflow Visualization** (Interactive graph editor)
173+
- **Interactive Init Wizard** (`agk init -i`)
174+
- **MCP Server Management**
175+
- **RAG & Knowledge Base Management**
151176

152177
---
153178

cmd/init.go

Lines changed: 65 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"go.opentelemetry.io/otel/attribute"
1313
"go.opentelemetry.io/otel/codes"
1414

15+
"github.com/agenticgokit/agk/pkg/registry"
1516
"github.com/agenticgokit/agk/pkg/scaffold"
1617
)
1718

@@ -46,11 +47,20 @@ Examples:
4647
# Initialize project interactively
4748
agk init my-project
4849
49-
# Initialize with specific template
50-
agk init my-project --template simple-agent
50+
# Initialize with built-in template
51+
agk init my-project --template single-agent
52+
53+
# Initialize from a community template (registry)
54+
agk init my-project --template rag-agent
55+
56+
# Initialize from a GitHub repository
57+
agk init my-project --template github.com/username/my-template
58+
59+
# Initialize from a specific version
60+
agk init my-project --template github.com/username/my-template@v1.0.0
5161
5262
# Non-interactive initialization
53-
agk init my-project --template simple-agent --llm openai --agent-type single --force
63+
agk init my-project --template single-agent --llm openai --agent-type single --force
5464
5565
# Initialize in specific directory
5666
agk init my-project --output ./projects
@@ -109,23 +119,57 @@ func runInitCommand(cmd *cobra.Command, args []string) error {
109119
return err
110120
}
111121

112-
// Validate and get template type
113-
templateType, err := scaffold.ValidateTemplate(initTemplate)
114-
if err != nil {
115-
span.RecordError(err)
116-
span.SetStatus(codes.Error, "invalid template")
117-
color.Red("✗ %v", err)
118-
return err
119-
}
120-
span.SetAttributes(attribute.String("template_type", string(templateType)))
122+
// Try to get generator (built-in or external)
123+
var generator scaffold.TemplateGenerator
124+
var metadata scaffold.TemplateMetadata
125+
var templateType scaffold.TemplateType
126+
127+
// First, check if it's a built-in template
128+
builtInType, err := scaffold.ValidateTemplate(initTemplate)
129+
if err == nil {
130+
// It is built-in
131+
templateType = builtInType
132+
span.SetAttributes(attribute.String("template_type", string(templateType)))
133+
134+
gen, err := scaffold.GetTemplateGenerator(templateType)
135+
if err != nil {
136+
span.RecordError(err)
137+
span.SetStatus(codes.Error, "failed to get generator")
138+
color.Red("✗ Failed to get template generator: %v", err)
139+
return err
140+
}
141+
generator = gen
142+
metadata = gen.GetMetadata()
143+
} else {
144+
// Not built-in, try resolving as external template
145+
color.Cyan("ℹ️ Template '%s' not found locally, checking registry...", initTemplate)
146+
147+
cm, err := registry.NewCacheManager("")
148+
if err != nil {
149+
return fmt.Errorf("failed to init cache manager: %w", err)
150+
}
151+
resolver := registry.NewResolver(cm)
152+
153+
cached, err := resolver.Resolve(ctx, initTemplate)
154+
if err != nil {
155+
// Failed both built-in and external
156+
err = fmt.Errorf("template '%s' not found (neither built-in nor registry): %w", initTemplate, err)
157+
span.RecordError(err)
158+
span.SetStatus(codes.Error, "invalid template")
159+
color.Red("✗ %v", err)
160+
return err
161+
}
121162

122-
// Get template generator
123-
generator, err := scaffold.GetTemplateGenerator(templateType)
124-
if err != nil {
125-
span.RecordError(err)
126-
span.SetStatus(codes.Error, "failed to get generator")
127-
color.Red("✗ Failed to get template generator: %v", err)
128-
return err
163+
gen := scaffold.NewExternalGenerator(cached)
164+
generator = gen
165+
metadata = gen.GetMetadata()
166+
templateType = scaffold.TemplateType("external") // Dummy type for next steps
167+
168+
span.SetAttributes(
169+
attribute.String("template_type", "external"),
170+
attribute.String("external_source", cached.Source),
171+
)
172+
color.Green("✓ Found template '%s' version %s", cached.Name, cached.Version)
129173
}
130174

131175
// Prepare generation options
@@ -141,7 +185,7 @@ func runInitCommand(cmd *cobra.Command, args []string) error {
141185
}
142186

143187
// Print header with template info
144-
metadata := generator.GetMetadata()
188+
metadata = generator.GetMetadata()
145189
color.Cyan("\n📦 Creating new AgenticGoKit project: %s\n", projectName)
146190
color.Cyan(" Template: %s (%s) - %s\n", metadata.Name, metadata.Complexity, metadata.Description)
147191
color.Cyan(" Files: %d | Features: %v\n", metadata.FileCount, metadata.Features)
@@ -203,16 +247,6 @@ func listTemplates() {
203247
switch tmpl.Name {
204248
case "Quickstart":
205249
templateID = "quickstart"
206-
case "Single-Agent":
207-
templateID = "single-agent"
208-
case "Multi-Agent":
209-
templateID = "multi-agent"
210-
case "Config-Driven":
211-
templateID = "config-driven"
212-
case "Advanced":
213-
templateID = "advanced"
214-
case "MCP-Tools":
215-
templateID = "mcp-tools"
216250
case "Workflow":
217251
templateID = "workflow"
218252
}
@@ -261,24 +295,10 @@ func printNextSteps(_ string, projectPath string, templateType scaffold.Template
261295
case scaffold.TemplateQuickstart:
262296
fmt.Printf(" • %s\n", color.CyanString("main.go # Entry point with hardcoded agent config"))
263297
fmt.Printf(" • %s\n", color.CyanString("go.mod # Go module definition"))
264-
case scaffold.TemplateSingleAgent:
265-
fmt.Printf(" • %s\n", color.CyanString("main.go # Entry point with streaming support"))
266-
fmt.Printf(" • %s\n", color.CyanString(".env # Environment variables (API keys)"))
267-
fmt.Printf(" • %s\n", color.CyanString("go.mod # Go module definition"))
268-
case scaffold.TemplateMCPTools:
269-
fmt.Printf(" • %s\n", color.CyanString("main.go # Agent with MCP server config"))
270-
fmt.Printf(" • %s\n", color.CyanString("README.md # Documentation for MCP tools"))
271-
fmt.Printf(" • %s\n", color.CyanString("go.mod # Go module definition"))
272298
case scaffold.TemplateWorkflow:
273299
fmt.Printf(" • %s\n", color.CyanString("main.go # Multi-step workflow pipeline"))
274300
fmt.Printf(" • %s\n", color.CyanString("README.md # Documentation for workflow"))
275301
fmt.Printf(" • %s\n", color.CyanString("go.mod # Go module definition"))
276-
case scaffold.TemplateMultiAgent, scaffold.TemplateConfigDriven, scaffold.TemplateAdvanced:
277-
// Complex templates structure
278-
fmt.Printf(" • %s\n", color.CyanString("main.go # Entry point"))
279-
fmt.Printf(" • %s\n", color.CyanString("config/ # Configuration files"))
280-
fmt.Printf(" • %s\n", color.CyanString("agents/ # Agent definitions"))
281-
fmt.Printf(" • %s\n", color.CyanString("go.mod # Go module definition"))
282302
default:
283303
// Generic structure for other templates
284304
fmt.Printf(" • %s\n", color.CyanString("main.go # Entry point"))
@@ -295,24 +315,10 @@ func printNextSteps(_ string, projectPath string, templateType scaffold.Template
295315
fmt.Printf(" • Modify the %s to customize the agent behavior\n", color.CyanString("SystemPrompt"))
296316
fmt.Printf(" • Try different LLM providers: %s, %s, %s\n",
297317
color.CyanString("openai"), color.CyanString("anthropic"), color.CyanString("ollama"))
298-
case scaffold.TemplateSingleAgent:
299-
fmt.Printf(" • Set API keys in %s (copy from %s)\n", color.CyanString(".env"), color.CyanString(".env.example"))
300-
fmt.Printf(" • Configure LLM provider and model in %s\n", color.CyanString("main.go"))
301-
fmt.Printf(" • Add tools/MCP servers to extend agent capabilities\n")
302-
case scaffold.TemplateMCPTools:
303-
fmt.Printf(" • Run %s to initialize MCP servers\n", color.CyanString("npm install"))
304-
fmt.Printf(" • Add more MCP servers in %s\n", color.CyanString("main.go"))
305-
fmt.Printf(" • Use %s to view traces of tool execution\n", color.CyanString("agk trace"))
306318
case scaffold.TemplateWorkflow:
307319
fmt.Printf(" • Add new step in %s using .AddStep()\n", color.CyanString("main.go"))
308320
fmt.Printf(" • Monitor step progress via streaming output\n")
309321
fmt.Printf(" • Use %s to debug workflow execution\n", color.CyanString("agk trace"))
310-
case scaffold.TemplateMultiAgent:
311-
fmt.Printf(" • Define agents in %s\n", color.CyanString("agents/"))
312-
fmt.Printf(" • Configure orchestration in %s\n", color.CyanString("main.go"))
313-
case scaffold.TemplateConfigDriven, scaffold.TemplateAdvanced:
314-
fmt.Printf(" • Modify configuration in %s\n", color.CyanString("config/"))
315-
fmt.Printf(" • Extend functionality by adding new modules\n")
316322
default:
317323
fmt.Printf(" • Configure your LLM provider and API keys\n")
318324
fmt.Printf(" • Explore the generated code to understand the structure\n")
@@ -328,7 +334,7 @@ func init() {
328334
// Define flags
329335
initCmd.Flags().BoolVar(&initListTemplates, "list", false, "List available templates")
330336
initCmd.Flags().StringVarP(&initTemplate, "template", "t", "quickstart",
331-
"Template type: quickstart, single-agent, multi-agent, config-driven, advanced, mcp-tools, workflow")
337+
"Template type: quickstart, workflow")
332338
initCmd.Flags().StringVarP(&initOutputDir, "output", "o", ".", "Output directory for the project")
333339
initCmd.Flags().BoolVarP(&initInteractive, "interactive", "i", false, "Enable interactive prompts")
334340
initCmd.Flags().BoolVarP(&initForce, "force", "f", false, "Force overwrite existing files")

0 commit comments

Comments
 (0)