solid_agent 0.0.0 → 0.2.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +68 -0
- data/LICENSE +21 -0
- data/README.md +321 -0
- data/Rakefile +32 -0
- data/docs/agent-md-spec.md +803 -0
- data/docs/parser-design.md +1369 -0
- data/docs/registry-api.md +882 -0
- data/examples/README.md +60 -0
- data/examples/manifests/changelog_writer.agent.md +81 -0
- data/examples/manifests/usage.rb +96 -0
- data/examples/memory_handoff/app/agents/researcher_agent.rb +36 -0
- data/examples/memory_handoff/app/agents/writer_agent.rb +41 -0
- data/examples/memory_handoff/usage.rb +45 -0
- data/examples/persistent_conversation/app/agents/support_agent.rb +59 -0
- data/examples/persistent_conversation/app/controllers/support_conversations_controller.rb +24 -0
- data/examples/persistent_conversation/app/views/agents/support/instructions.md.erb +8 -0
- data/examples/persistent_conversation/usage.rb +51 -0
- data/examples/reasoning/app/agents/analysis_agent.rb +52 -0
- data/examples/reasoning/usage.rb +52 -0
- data/examples/run_tracking/app/agents/report_agent.rb +30 -0
- data/examples/run_tracking/app/controllers/agent_runs_controller.rb +43 -0
- data/examples/run_tracking/app/jobs/document_analysis_job.rb +17 -0
- data/examples/run_tracking/app/services/document_analysis_run.rb +68 -0
- data/examples/run_tracking/usage.rb +85 -0
- data/examples/tool_streaming/app/agents/browser_agent.rb +65 -0
- data/examples/tool_streaming/app/channels/tool_status_channel.rb +24 -0
- data/examples/tool_streaming/app/views/browser_agent/tools/fetch_url.json.erb +15 -0
- data/examples/tool_streaming/usage.rb +47 -0
- data/lib/generators/solid_agent/agent/agent_generator.rb +95 -0
- data/lib/generators/solid_agent/agent/templates/action.text.erb +10 -0
- data/lib/generators/solid_agent/agent/templates/agent.rb.erb +93 -0
- data/lib/generators/solid_agent/context/context_generator.rb +124 -0
- data/lib/generators/solid_agent/context/templates/context_model.rb.erb +134 -0
- data/lib/generators/solid_agent/context/templates/create_context.rb.erb +32 -0
- data/lib/generators/solid_agent/context/templates/create_generations.rb.erb +46 -0
- data/lib/generators/solid_agent/context/templates/create_messages.rb.erb +37 -0
- data/lib/generators/solid_agent/context/templates/generation_model.rb.erb +51 -0
- data/lib/generators/solid_agent/context/templates/message_model.rb.erb +47 -0
- data/lib/generators/solid_agent/install/install_generator.rb +92 -0
- data/lib/generators/solid_agent/install/templates/agent_context.rb.erb +171 -0
- data/lib/generators/solid_agent/install/templates/agent_generation.rb.erb +76 -0
- data/lib/generators/solid_agent/install/templates/agent_memory.rb.erb +51 -0
- data/lib/generators/solid_agent/install/templates/agent_memory_entry.rb.erb +12 -0
- data/lib/generators/solid_agent/install/templates/agent_message.rb.erb +76 -0
- data/lib/generators/solid_agent/install/templates/agent_run.rb.erb +122 -0
- data/lib/generators/solid_agent/install/templates/create_agent_contexts.rb.erb +32 -0
- data/lib/generators/solid_agent/install/templates/create_agent_generations.rb.erb +51 -0
- data/lib/generators/solid_agent/install/templates/create_agent_memories.rb.erb +35 -0
- data/lib/generators/solid_agent/install/templates/create_agent_messages.rb.erb +38 -0
- data/lib/generators/solid_agent/install/templates/create_agent_runs.rb.erb +46 -0
- data/lib/generators/solid_agent/install/templates/initializer.rb.erb +51 -0
- data/lib/generators/solid_agent/manifest/manifest_generator.rb +209 -0
- data/lib/generators/solid_agent/manifest/templates/agent.md.erb +39 -0
- data/lib/generators/solid_agent/manifest/templates/prompt.erb +13 -0
- data/lib/generators/solid_agent/reasons/reasons_generator.rb +83 -0
- data/lib/generators/solid_agent/reasons/templates/add_reasoning_columns.rb.erb +12 -0
- data/lib/generators/solid_agent/tool/templates/tool.json.erb +19 -0
- data/lib/generators/solid_agent/tool/tool_generator.rb +117 -0
- data/lib/solid_agent/agent_manifest/agent_builder.rb +323 -0
- data/lib/solid_agent/agent_manifest/errors.rb +26 -0
- data/lib/solid_agent/agent_manifest/exporter_registry.rb +117 -0
- data/lib/solid_agent/agent_manifest/exporters/agent_md_exporter.rb +115 -0
- data/lib/solid_agent/agent_manifest/exporters/base_exporter.rb +152 -0
- data/lib/solid_agent/agent_manifest/exporters/crewai_exporter.rb +125 -0
- data/lib/solid_agent/agent_manifest/exporters/dotprompt_exporter.rb +92 -0
- data/lib/solid_agent/agent_manifest/input_schema.rb +154 -0
- data/lib/solid_agent/agent_manifest/manifest.rb +306 -0
- data/lib/solid_agent/agent_manifest/parser_registry.rb +185 -0
- data/lib/solid_agent/agent_manifest/parsers/agent_md_parser.rb +87 -0
- data/lib/solid_agent/agent_manifest/parsers/base_parser.rb +223 -0
- data/lib/solid_agent/agent_manifest/parsers/crewai_parser.rb +201 -0
- data/lib/solid_agent/agent_manifest/parsers/dotprompt_parser.rb +122 -0
- data/lib/solid_agent/agent_manifest/parsers/github_prompt_parser.rb +143 -0
- data/lib/solid_agent/agent_manifest/picoschema.rb +254 -0
- data/lib/solid_agent/agent_manifest/registry/auth.rb +103 -0
- data/lib/solid_agent/agent_manifest/registry/client.rb +384 -0
- data/lib/solid_agent/agent_manifest/resource.rb +103 -0
- data/lib/solid_agent/agent_manifest/tool.rb +160 -0
- data/lib/solid_agent/agent_manifest/validator.rb +368 -0
- data/lib/solid_agent/agent_manifest.rb +381 -0
- data/lib/solid_agent/engine.rb +16 -0
- data/lib/solid_agent/has_context.rb +670 -0
- data/lib/solid_agent/has_memory.rb +136 -0
- data/lib/solid_agent/has_reasons.rb +230 -0
- data/lib/solid_agent/has_tools.rb +257 -0
- data/lib/solid_agent/model_naming.rb +42 -0
- data/lib/solid_agent/model_pricing.rb +93 -0
- data/lib/solid_agent/reasonable/reason.rb +205 -0
- data/lib/solid_agent/reasonable.rb +181 -0
- data/lib/solid_agent/records/agent.rb +520 -0
- data/lib/solid_agent/records/agent_run.rb +520 -0
- data/lib/solid_agent/records/agent_template.rb +142 -0
- data/lib/solid_agent/records/agent_version.rb +141 -0
- data/lib/solid_agent/records/ownable.rb +130 -0
- data/lib/solid_agent/records.rb +152 -0
- data/lib/solid_agent/run_fingerprint.rb +51 -0
- data/lib/solid_agent/streams_tool_updates.rb +178 -0
- data/lib/solid_agent/tool_cache.rb +91 -0
- data/lib/solid_agent/version.rb +5 -0
- data/lib/solid_agent.rb +95 -0
- data/sig/solid_agent.rbs +4 -0
- metadata +174 -14
|
@@ -0,0 +1,803 @@
|
|
|
1
|
+
# `.agent.md` Specification
|
|
2
|
+
|
|
3
|
+
**Version:** 0.1.0-draft
|
|
4
|
+
**Status:** Draft
|
|
5
|
+
**Authors:** ActiveAgents Contributors
|
|
6
|
+
**License:** Apache 2.0
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
`.agent.md` is an open, portable format for defining AI agents. It uses Markdown with YAML frontmatter to create human-readable, version-control-friendly agent definitions that can be shared across frameworks and platforms.
|
|
11
|
+
|
|
12
|
+
### Design Goals
|
|
13
|
+
|
|
14
|
+
1. **Human Readable** - Authors can read and write agents without tooling
|
|
15
|
+
2. **Portable** - Agents can run on multiple frameworks (ActiveAgent, CrewAI, LangChain, Genkit)
|
|
16
|
+
3. **Git-Friendly** - Clean diffs, easy code review, works with existing workflows
|
|
17
|
+
4. **Standards-Based** - Builds on existing specs (Dotprompt, MCP, JSON Schema, AGENTS.md)
|
|
18
|
+
5. **Extensible** - Framework-specific features via namespaced sections
|
|
19
|
+
|
|
20
|
+
## File Structure
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
┌─────────────────────────────────────┐
|
|
24
|
+
│ --- │ YAML Frontmatter
|
|
25
|
+
│ name: my-agent │ (structured metadata)
|
|
26
|
+
│ model: anthropic/claude-sonnet-4-20250514 │
|
|
27
|
+
│ ... │
|
|
28
|
+
│ --- │
|
|
29
|
+
├─────────────────────────────────────┤
|
|
30
|
+
│ # Agent Title │ Markdown Body
|
|
31
|
+
│ │ (instructions + prompt template)
|
|
32
|
+
│ You are a helpful assistant... │
|
|
33
|
+
│ │
|
|
34
|
+
│ {{#if context}} │ Handlebars templating
|
|
35
|
+
│ Consider: {{context}} │
|
|
36
|
+
│ {{/if}} │
|
|
37
|
+
└─────────────────────────────────────┘
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Frontmatter Schema
|
|
41
|
+
|
|
42
|
+
### Meta Fields
|
|
43
|
+
|
|
44
|
+
| Field | Type | Required | Description |
|
|
45
|
+
|-------|------|----------|-------------|
|
|
46
|
+
| `name` | string | Yes | Unique identifier (lowercase, hyphens) |
|
|
47
|
+
| `version` | string | No | SemVer version (default: "1.0.0") |
|
|
48
|
+
| `description` | string | No | Brief description (max 280 chars) |
|
|
49
|
+
| `author` | string | No | Author name or organization |
|
|
50
|
+
| `license` | string | No | SPDX license identifier |
|
|
51
|
+
| `repository` | string | No | Source repository URL |
|
|
52
|
+
| `tags` | string[] | No | Categorization tags |
|
|
53
|
+
| `extends` | string | No | Parent agent to inherit from |
|
|
54
|
+
|
|
55
|
+
```yaml
|
|
56
|
+
---
|
|
57
|
+
name: research-assistant
|
|
58
|
+
version: 1.2.0
|
|
59
|
+
description: An agent that researches topics and synthesizes findings
|
|
60
|
+
author: activeagents
|
|
61
|
+
license: MIT
|
|
62
|
+
repository: https://github.com/activeagents/research-assistant
|
|
63
|
+
tags: [research, web, summarization, rag]
|
|
64
|
+
extends: "@activeagents/base-assistant"
|
|
65
|
+
---
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Model Configuration
|
|
69
|
+
|
|
70
|
+
| Field | Type | Required | Description |
|
|
71
|
+
|-------|------|----------|-------------|
|
|
72
|
+
| `model` | string | Yes | Model identifier (`provider/model-name`) |
|
|
73
|
+
| `config` | object | No | Model-specific parameters |
|
|
74
|
+
| `config.temperature` | number | No | Sampling temperature (0.0-2.0) |
|
|
75
|
+
| `config.max_tokens` | number | No | Maximum response tokens |
|
|
76
|
+
| `config.top_p` | number | No | Nucleus sampling parameter |
|
|
77
|
+
| `config.stop` | string[] | No | Stop sequences |
|
|
78
|
+
|
|
79
|
+
```yaml
|
|
80
|
+
model: anthropic/claude-sonnet-4-20250514
|
|
81
|
+
config:
|
|
82
|
+
temperature: 0.7
|
|
83
|
+
max_tokens: 4096
|
|
84
|
+
top_p: 0.9
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
#### Model Identifier Format
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
provider/model-name[:version]
|
|
91
|
+
|
|
92
|
+
Examples:
|
|
93
|
+
anthropic/claude-sonnet-4-20250514
|
|
94
|
+
openai/gpt-4o
|
|
95
|
+
google/gemini-2.0-flash
|
|
96
|
+
ollama/llama3:70b
|
|
97
|
+
azure/gpt-4o:2024-05-13
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Input Schema
|
|
101
|
+
|
|
102
|
+
Defines the expected input parameters using [Picoschema](#picoschema) (compact) or [JSON Schema](#json-schema) (full).
|
|
103
|
+
|
|
104
|
+
```yaml
|
|
105
|
+
# Picoschema (compact, Dotprompt-compatible)
|
|
106
|
+
input:
|
|
107
|
+
schema:
|
|
108
|
+
query: string, the research question to investigate
|
|
109
|
+
depth?: string(shallow, moderate, deep), how thorough the research should be
|
|
110
|
+
max_sources?: integer, maximum number of sources to cite
|
|
111
|
+
|
|
112
|
+
# OR JSON Schema (full)
|
|
113
|
+
input:
|
|
114
|
+
schema:
|
|
115
|
+
type: object
|
|
116
|
+
properties:
|
|
117
|
+
query:
|
|
118
|
+
type: string
|
|
119
|
+
description: The research question to investigate
|
|
120
|
+
depth:
|
|
121
|
+
type: string
|
|
122
|
+
enum: [shallow, moderate, deep]
|
|
123
|
+
default: moderate
|
|
124
|
+
max_sources:
|
|
125
|
+
type: integer
|
|
126
|
+
minimum: 1
|
|
127
|
+
maximum: 20
|
|
128
|
+
default: 5
|
|
129
|
+
required: [query]
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Output Schema
|
|
133
|
+
|
|
134
|
+
Defines the expected output format and structure.
|
|
135
|
+
|
|
136
|
+
```yaml
|
|
137
|
+
output:
|
|
138
|
+
format: json # json | text | markdown
|
|
139
|
+
schema:
|
|
140
|
+
summary: string, executive summary of findings
|
|
141
|
+
confidence: number, confidence score 0-1
|
|
142
|
+
sources: [object], list of referenced sources
|
|
143
|
+
url: string, source URL
|
|
144
|
+
title: string, page title
|
|
145
|
+
snippet: string, relevant excerpt
|
|
146
|
+
relevance: number, relevance score 0-1
|
|
147
|
+
follow_up?: [string], suggested follow-up questions
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Tools Definition
|
|
151
|
+
|
|
152
|
+
Tools follow [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) conventions for maximum portability.
|
|
153
|
+
|
|
154
|
+
```yaml
|
|
155
|
+
tools:
|
|
156
|
+
# Inline definition
|
|
157
|
+
- name: web_search
|
|
158
|
+
description: Search the web for information
|
|
159
|
+
inputSchema:
|
|
160
|
+
type: object
|
|
161
|
+
properties:
|
|
162
|
+
query:
|
|
163
|
+
type: string
|
|
164
|
+
description: Search query
|
|
165
|
+
num_results:
|
|
166
|
+
type: integer
|
|
167
|
+
default: 10
|
|
168
|
+
maximum: 50
|
|
169
|
+
required: [query]
|
|
170
|
+
|
|
171
|
+
# Reference to external tool file
|
|
172
|
+
- $ref: "./tools/navigate.tool.json"
|
|
173
|
+
|
|
174
|
+
# Reference to tool pack
|
|
175
|
+
- $ref: "@activeagents/web-tools/search"
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
#### Tool File Format (`.tool.json`)
|
|
179
|
+
|
|
180
|
+
Standalone tool definitions compatible with MCP:
|
|
181
|
+
|
|
182
|
+
```json
|
|
183
|
+
{
|
|
184
|
+
"name": "navigate",
|
|
185
|
+
"description": "Navigate to a URL and extract page content",
|
|
186
|
+
"inputSchema": {
|
|
187
|
+
"type": "object",
|
|
188
|
+
"properties": {
|
|
189
|
+
"url": {
|
|
190
|
+
"type": "string",
|
|
191
|
+
"format": "uri",
|
|
192
|
+
"description": "The URL to navigate to"
|
|
193
|
+
},
|
|
194
|
+
"extract": {
|
|
195
|
+
"type": "string",
|
|
196
|
+
"enum": ["text", "html", "markdown"],
|
|
197
|
+
"default": "markdown"
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
"required": ["url"]
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Resources (MCP-compatible)
|
|
206
|
+
|
|
207
|
+
External data sources the agent can access:
|
|
208
|
+
|
|
209
|
+
```yaml
|
|
210
|
+
resources:
|
|
211
|
+
- name: company_docs
|
|
212
|
+
description: Internal company documentation
|
|
213
|
+
uri: "file:///docs/**/*.md"
|
|
214
|
+
mimeType: text/markdown
|
|
215
|
+
|
|
216
|
+
- name: api_spec
|
|
217
|
+
description: API specification
|
|
218
|
+
uri: "https://api.example.com/openapi.json"
|
|
219
|
+
mimeType: application/json
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Framework Extensions
|
|
223
|
+
|
|
224
|
+
Framework-specific configuration lives in namespaced sections. Other frameworks SHOULD ignore unrecognized namespaces.
|
|
225
|
+
|
|
226
|
+
#### ActiveAgent Extension
|
|
227
|
+
|
|
228
|
+
```yaml
|
|
229
|
+
activeagent:
|
|
230
|
+
class_name: ResearchAssistantAgent
|
|
231
|
+
parent_class: ApplicationAgent
|
|
232
|
+
concerns:
|
|
233
|
+
- has_context:
|
|
234
|
+
contextual: user
|
|
235
|
+
context_name: research_session
|
|
236
|
+
- has_tools: [web_search, navigate, summarize]
|
|
237
|
+
- streams_tool_updates:
|
|
238
|
+
channel: research_progress
|
|
239
|
+
callbacks:
|
|
240
|
+
before_prompt: validate_query
|
|
241
|
+
after_generation: log_research
|
|
242
|
+
queued: true # Run via ActiveJob
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
#### CrewAI Extension
|
|
246
|
+
|
|
247
|
+
```yaml
|
|
248
|
+
crewai:
|
|
249
|
+
role: Senior Research Analyst
|
|
250
|
+
goal: Conduct thorough research and provide actionable insights
|
|
251
|
+
backstory: >
|
|
252
|
+
You are a seasoned research analyst with 15 years of experience
|
|
253
|
+
in investigative journalism and academic research.
|
|
254
|
+
allow_delegation: true
|
|
255
|
+
verbose: true
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
#### LangChain Extension
|
|
259
|
+
|
|
260
|
+
```yaml
|
|
261
|
+
langchain:
|
|
262
|
+
agent_type: openai-tools
|
|
263
|
+
memory:
|
|
264
|
+
type: conversation_buffer
|
|
265
|
+
max_tokens: 4000
|
|
266
|
+
callbacks:
|
|
267
|
+
- langsmith
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## Markdown Body
|
|
271
|
+
|
|
272
|
+
The body contains the agent's instructions and prompt template using Markdown with optional Handlebars templating.
|
|
273
|
+
|
|
274
|
+
### Structure
|
|
275
|
+
|
|
276
|
+
```markdown
|
|
277
|
+
# Agent Title
|
|
278
|
+
|
|
279
|
+
Brief description of the agent's purpose.
|
|
280
|
+
|
|
281
|
+
## Instructions
|
|
282
|
+
|
|
283
|
+
Core behavioral instructions for the agent.
|
|
284
|
+
|
|
285
|
+
## Guidelines
|
|
286
|
+
|
|
287
|
+
Specific rules and constraints.
|
|
288
|
+
|
|
289
|
+
## Examples
|
|
290
|
+
|
|
291
|
+
{{#if include_examples}}
|
|
292
|
+
### Example 1: Basic Query
|
|
293
|
+
User: What is quantum computing?
|
|
294
|
+
Assistant: [Example response...]
|
|
295
|
+
{{/if}}
|
|
296
|
+
|
|
297
|
+
## Context
|
|
298
|
+
|
|
299
|
+
{{#if context}}
|
|
300
|
+
Consider the following context:
|
|
301
|
+
{{context}}
|
|
302
|
+
{{/if}}
|
|
303
|
+
|
|
304
|
+
## Task
|
|
305
|
+
|
|
306
|
+
{{task}}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Templating
|
|
310
|
+
|
|
311
|
+
Uses [Handlebars](https://handlebarsjs.com/) syntax (Dotprompt-compatible):
|
|
312
|
+
|
|
313
|
+
| Syntax | Description |
|
|
314
|
+
|--------|-------------|
|
|
315
|
+
| `{{variable}}` | Insert variable (HTML-escaped) |
|
|
316
|
+
| `{{{variable}}}` | Insert variable (raw, unescaped) |
|
|
317
|
+
| `{{#if condition}}...{{/if}}` | Conditional block |
|
|
318
|
+
| `{{#unless condition}}...{{/unless}}` | Negative conditional |
|
|
319
|
+
| `{{#each items}}...{{/each}}` | Iteration |
|
|
320
|
+
| `{{> partial}}` | Include partial template |
|
|
321
|
+
|
|
322
|
+
#### Built-in Variables
|
|
323
|
+
|
|
324
|
+
| Variable | Description |
|
|
325
|
+
|----------|-------------|
|
|
326
|
+
| `{{input.*}}` | Input schema fields |
|
|
327
|
+
| `{{context}}` | Loaded context (if using HasContext) |
|
|
328
|
+
| `{{messages}}` | Conversation history |
|
|
329
|
+
| `{{tools}}` | Available tool descriptions |
|
|
330
|
+
| `{{datetime}}` | Current ISO datetime |
|
|
331
|
+
| `{{agent.name}}` | Agent name from frontmatter |
|
|
332
|
+
|
|
333
|
+
### Sections
|
|
334
|
+
|
|
335
|
+
Reserved section headers with semantic meaning:
|
|
336
|
+
|
|
337
|
+
| Section | Purpose |
|
|
338
|
+
|---------|---------|
|
|
339
|
+
| `# {Title}` | Agent title (H1) |
|
|
340
|
+
| `## Instructions` | Core behavioral instructions |
|
|
341
|
+
| `## Guidelines` | Rules and constraints |
|
|
342
|
+
| `## Examples` | Few-shot examples |
|
|
343
|
+
| `## Context` | Dynamic context insertion |
|
|
344
|
+
| `## Task` | The specific task template |
|
|
345
|
+
| `## Output Format` | Expected output structure |
|
|
346
|
+
|
|
347
|
+
## Picoschema
|
|
348
|
+
|
|
349
|
+
Picoschema is a compact, YAML-optimized schema format (from Dotprompt):
|
|
350
|
+
|
|
351
|
+
### Scalar Types
|
|
352
|
+
|
|
353
|
+
| Type | Description |
|
|
354
|
+
|------|-------------|
|
|
355
|
+
| `string` | Text value |
|
|
356
|
+
| `integer` | Whole number |
|
|
357
|
+
| `number` | Decimal number |
|
|
358
|
+
| `boolean` | true/false |
|
|
359
|
+
| `any` | Any type |
|
|
360
|
+
|
|
361
|
+
### Modifiers
|
|
362
|
+
|
|
363
|
+
| Syntax | Meaning |
|
|
364
|
+
|--------|---------|
|
|
365
|
+
| `field?` | Optional field |
|
|
366
|
+
| `field: type, description` | Field with description |
|
|
367
|
+
| `field: type(a, b, c)` | Enum values |
|
|
368
|
+
| `field: [type]` | Array of type |
|
|
369
|
+
| `field: [object]` | Array of objects (indent children) |
|
|
370
|
+
|
|
371
|
+
### Examples
|
|
372
|
+
|
|
373
|
+
```yaml
|
|
374
|
+
# Simple types
|
|
375
|
+
name: string
|
|
376
|
+
age: integer
|
|
377
|
+
score: number
|
|
378
|
+
active: boolean
|
|
379
|
+
|
|
380
|
+
# Optional fields
|
|
381
|
+
nickname?: string
|
|
382
|
+
metadata?: any
|
|
383
|
+
|
|
384
|
+
# With descriptions
|
|
385
|
+
email: string, user's email address
|
|
386
|
+
priority: integer, 1-5 priority level
|
|
387
|
+
|
|
388
|
+
# Enums
|
|
389
|
+
status: string(draft, published, archived)
|
|
390
|
+
size: string(small, medium, large)
|
|
391
|
+
|
|
392
|
+
# Arrays
|
|
393
|
+
tags: [string]
|
|
394
|
+
scores: [number]
|
|
395
|
+
|
|
396
|
+
# Nested objects
|
|
397
|
+
author: object
|
|
398
|
+
name: string
|
|
399
|
+
email: string
|
|
400
|
+
|
|
401
|
+
# Array of objects
|
|
402
|
+
comments: [object]
|
|
403
|
+
author: string
|
|
404
|
+
text: string
|
|
405
|
+
timestamp: string
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
## File Organization
|
|
409
|
+
|
|
410
|
+
### Single-File Agent
|
|
411
|
+
|
|
412
|
+
```
|
|
413
|
+
my-agent.agent.md
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### Multi-File Agent (Package)
|
|
417
|
+
|
|
418
|
+
```
|
|
419
|
+
my-agent/
|
|
420
|
+
├── agent.md # Main definition (required)
|
|
421
|
+
├── README.md # Human documentation
|
|
422
|
+
├── CHANGELOG.md # Version history
|
|
423
|
+
├── LICENSE # License file
|
|
424
|
+
│
|
|
425
|
+
├── tools/ # Tool definitions
|
|
426
|
+
│ ├── search.tool.json
|
|
427
|
+
│ └── analyze.tool.json
|
|
428
|
+
│
|
|
429
|
+
├── prompts/ # Partial templates
|
|
430
|
+
│ ├── _header.md
|
|
431
|
+
│ └── _examples.md
|
|
432
|
+
│
|
|
433
|
+
├── examples/ # Example inputs/contexts
|
|
434
|
+
│ ├── basic.input.json
|
|
435
|
+
│ └── advanced.input.json
|
|
436
|
+
│
|
|
437
|
+
└── tests/ # Test cases
|
|
438
|
+
├── unit.test.yml
|
|
439
|
+
└── integration.test.yml
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
### Package Manifest (`agent.json`)
|
|
443
|
+
|
|
444
|
+
For published packages:
|
|
445
|
+
|
|
446
|
+
```json
|
|
447
|
+
{
|
|
448
|
+
"name": "@activeagents/research-assistant",
|
|
449
|
+
"version": "1.2.0",
|
|
450
|
+
"description": "An agent that researches topics and synthesizes findings",
|
|
451
|
+
"main": "agent.md",
|
|
452
|
+
"files": [
|
|
453
|
+
"agent.md",
|
|
454
|
+
"tools/*.tool.json",
|
|
455
|
+
"prompts/*.md"
|
|
456
|
+
],
|
|
457
|
+
"keywords": ["research", "web", "summarization"],
|
|
458
|
+
"author": "ActiveAgents <hello@activeagents.ai>",
|
|
459
|
+
"license": "MIT",
|
|
460
|
+
"repository": {
|
|
461
|
+
"type": "git",
|
|
462
|
+
"url": "https://github.com/activeagents/research-assistant"
|
|
463
|
+
},
|
|
464
|
+
"dependencies": {
|
|
465
|
+
"@activeagents/web-tools": "^1.0.0"
|
|
466
|
+
},
|
|
467
|
+
"engines": {
|
|
468
|
+
"activeagent": ">=0.5.0"
|
|
469
|
+
},
|
|
470
|
+
"compatibility": {
|
|
471
|
+
"frameworks": ["activeagent", "crewai", "langchain", "genkit"]
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
## Test Format
|
|
477
|
+
|
|
478
|
+
### Test Cases (`*.test.yml`)
|
|
479
|
+
|
|
480
|
+
```yaml
|
|
481
|
+
name: Research Assistant Tests
|
|
482
|
+
agent: ./agent.md
|
|
483
|
+
|
|
484
|
+
cases:
|
|
485
|
+
- name: basic_research_query
|
|
486
|
+
description: Should handle a simple research question
|
|
487
|
+
input:
|
|
488
|
+
query: "What are the benefits of meditation?"
|
|
489
|
+
depth: shallow
|
|
490
|
+
expect:
|
|
491
|
+
output:
|
|
492
|
+
summary: { contains: "meditation" }
|
|
493
|
+
sources: { min_length: 2 }
|
|
494
|
+
confidence: { gte: 0.7 }
|
|
495
|
+
tools_called: [web_search]
|
|
496
|
+
no_errors: true
|
|
497
|
+
|
|
498
|
+
- name: deep_research_with_sources
|
|
499
|
+
description: Should cite multiple sources for deep research
|
|
500
|
+
input:
|
|
501
|
+
query: "Compare quantum computing approaches"
|
|
502
|
+
depth: deep
|
|
503
|
+
max_sources: 10
|
|
504
|
+
expect:
|
|
505
|
+
output:
|
|
506
|
+
sources: { min_length: 5, max_length: 10 }
|
|
507
|
+
tools_called: [web_search, navigate]
|
|
508
|
+
response_time: { lte: 30000 } # 30 seconds
|
|
509
|
+
|
|
510
|
+
- name: handles_invalid_input
|
|
511
|
+
description: Should gracefully handle missing query
|
|
512
|
+
input: {}
|
|
513
|
+
expect:
|
|
514
|
+
error: { contains: "query is required" }
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
### Context Fixtures (`*.context.json`)
|
|
518
|
+
|
|
519
|
+
```json
|
|
520
|
+
{
|
|
521
|
+
"name": "research_context_example",
|
|
522
|
+
"description": "Example context for testing research agent",
|
|
523
|
+
"messages": [
|
|
524
|
+
{
|
|
525
|
+
"role": "user",
|
|
526
|
+
"content": "Research the history of artificial intelligence"
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
"role": "assistant",
|
|
530
|
+
"content": "I'll research the history of AI for you..."
|
|
531
|
+
}
|
|
532
|
+
],
|
|
533
|
+
"metadata": {
|
|
534
|
+
"user_id": "test-user-123",
|
|
535
|
+
"session_id": "sess-456"
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
## Registry API
|
|
541
|
+
|
|
542
|
+
### Package Discovery
|
|
543
|
+
|
|
544
|
+
```
|
|
545
|
+
GET /api/v1/agents
|
|
546
|
+
GET /api/v1/agents?q=research&tags=web,rag
|
|
547
|
+
GET /api/v1/agents/@activeagents/research-assistant
|
|
548
|
+
GET /api/v1/agents/@activeagents/research-assistant/versions
|
|
549
|
+
GET /api/v1/agents/@activeagents/research-assistant/1.2.0
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
### Package Publishing
|
|
553
|
+
|
|
554
|
+
```
|
|
555
|
+
POST /api/v1/agents
|
|
556
|
+
Authorization: Bearer <token>
|
|
557
|
+
Content-Type: multipart/form-data
|
|
558
|
+
|
|
559
|
+
{package archive}
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
### Response Format
|
|
563
|
+
|
|
564
|
+
```json
|
|
565
|
+
{
|
|
566
|
+
"name": "@activeagents/research-assistant",
|
|
567
|
+
"version": "1.2.0",
|
|
568
|
+
"description": "An agent that researches topics and synthesizes findings",
|
|
569
|
+
"author": {
|
|
570
|
+
"name": "ActiveAgents",
|
|
571
|
+
"url": "https://activeagents.ai"
|
|
572
|
+
},
|
|
573
|
+
"downloads": {
|
|
574
|
+
"total": 15420,
|
|
575
|
+
"weekly": 342
|
|
576
|
+
},
|
|
577
|
+
"stars": 89,
|
|
578
|
+
"license": "MIT",
|
|
579
|
+
"tags": ["research", "web", "summarization"],
|
|
580
|
+
"compatibility": {
|
|
581
|
+
"frameworks": ["activeagent", "crewai", "langchain"],
|
|
582
|
+
"models": ["anthropic/*", "openai/*"]
|
|
583
|
+
},
|
|
584
|
+
"files": {
|
|
585
|
+
"agent.md": "https://cdn.activeagents.ai/...",
|
|
586
|
+
"tools/search.tool.json": "https://cdn.activeagents.ai/..."
|
|
587
|
+
},
|
|
588
|
+
"checksums": {
|
|
589
|
+
"agent.md": "sha256:abc123...",
|
|
590
|
+
"tools/search.tool.json": "sha256:def456..."
|
|
591
|
+
},
|
|
592
|
+
"created_at": "2025-01-15T10:30:00Z",
|
|
593
|
+
"updated_at": "2025-01-20T14:22:00Z"
|
|
594
|
+
}
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
## CLI Reference
|
|
598
|
+
|
|
599
|
+
```bash
|
|
600
|
+
# Initialize new agent
|
|
601
|
+
activeagent init my-agent
|
|
602
|
+
activeagent init my-agent --template research
|
|
603
|
+
|
|
604
|
+
# Validate agent definition
|
|
605
|
+
activeagent validate my-agent.agent.md
|
|
606
|
+
activeagent validate ./my-agent/
|
|
607
|
+
|
|
608
|
+
# Test agent locally
|
|
609
|
+
activeagent test my-agent.agent.md
|
|
610
|
+
activeagent test my-agent.agent.md --input examples/basic.input.json
|
|
611
|
+
activeagent test my-agent.agent.md --context examples/research.context.json
|
|
612
|
+
|
|
613
|
+
# Run agent interactively
|
|
614
|
+
activeagent run my-agent.agent.md
|
|
615
|
+
activeagent run my-agent.agent.md --input '{"query": "test"}'
|
|
616
|
+
|
|
617
|
+
# Search registry
|
|
618
|
+
activeagent search research
|
|
619
|
+
activeagent search --tags web,rag --framework activeagent
|
|
620
|
+
|
|
621
|
+
# Install from registry
|
|
622
|
+
activeagent add @activeagents/research-assistant
|
|
623
|
+
activeagent add @activeagents/research-assistant@1.2.0
|
|
624
|
+
|
|
625
|
+
# Fork agent
|
|
626
|
+
activeagent fork @activeagents/research-assistant my-researcher
|
|
627
|
+
|
|
628
|
+
# Publish to registry
|
|
629
|
+
activeagent login
|
|
630
|
+
activeagent publish
|
|
631
|
+
activeagent publish --tag beta
|
|
632
|
+
|
|
633
|
+
# Export to other formats
|
|
634
|
+
activeagent export my-agent.agent.md --format crewai
|
|
635
|
+
activeagent export my-agent.agent.md --format dotprompt
|
|
636
|
+
activeagent export my-agent.agent.md --format langchain
|
|
637
|
+
|
|
638
|
+
# Import from other formats
|
|
639
|
+
activeagent import agent.yaml --from crewai
|
|
640
|
+
activeagent import prompt.prompt --from dotprompt
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
## Compatibility Matrix
|
|
644
|
+
|
|
645
|
+
| Feature | ActiveAgent | CrewAI | LangChain | Genkit |
|
|
646
|
+
|---------|-------------|--------|-----------|--------|
|
|
647
|
+
| Basic metadata | ✅ | ✅ | ✅ | ✅ |
|
|
648
|
+
| Model config | ✅ | ✅ | ✅ | ✅ |
|
|
649
|
+
| Input schema | ✅ | ⚠️ | ✅ | ✅ |
|
|
650
|
+
| Output schema | ✅ | ⚠️ | ✅ | ✅ |
|
|
651
|
+
| Tools (MCP) | ✅ | ✅ | ✅ | ✅ |
|
|
652
|
+
| Handlebars | ✅ | ⚠️ | ⚠️ | ✅ |
|
|
653
|
+
| Framework extensions | ✅ | ✅ | ✅ | ⚠️ |
|
|
654
|
+
| Context persistence | ✅ | ❌ | ⚠️ | ❌ |
|
|
655
|
+
| Streaming | ✅ | ⚠️ | ✅ | ✅ |
|
|
656
|
+
|
|
657
|
+
✅ Full support | ⚠️ Partial/adapter needed | ❌ Not supported
|
|
658
|
+
|
|
659
|
+
## Examples
|
|
660
|
+
|
|
661
|
+
### Minimal Agent
|
|
662
|
+
|
|
663
|
+
```markdown
|
|
664
|
+
---
|
|
665
|
+
name: hello-world
|
|
666
|
+
model: openai/gpt-4o
|
|
667
|
+
---
|
|
668
|
+
|
|
669
|
+
# Hello World Agent
|
|
670
|
+
|
|
671
|
+
You are a friendly assistant. Greet the user warmly.
|
|
672
|
+
```
|
|
673
|
+
|
|
674
|
+
### Research Agent
|
|
675
|
+
|
|
676
|
+
```markdown
|
|
677
|
+
---
|
|
678
|
+
name: research-assistant
|
|
679
|
+
version: 1.0.0
|
|
680
|
+
model: anthropic/claude-sonnet-4-20250514
|
|
681
|
+
config:
|
|
682
|
+
temperature: 0.7
|
|
683
|
+
|
|
684
|
+
input:
|
|
685
|
+
schema:
|
|
686
|
+
query: string, the research question
|
|
687
|
+
depth?: string(shallow, deep)
|
|
688
|
+
|
|
689
|
+
output:
|
|
690
|
+
format: json
|
|
691
|
+
schema:
|
|
692
|
+
summary: string
|
|
693
|
+
sources: [object]
|
|
694
|
+
url: string
|
|
695
|
+
title: string
|
|
696
|
+
|
|
697
|
+
tools:
|
|
698
|
+
- name: web_search
|
|
699
|
+
description: Search the web
|
|
700
|
+
inputSchema:
|
|
701
|
+
type: object
|
|
702
|
+
properties:
|
|
703
|
+
query: { type: string }
|
|
704
|
+
required: [query]
|
|
705
|
+
|
|
706
|
+
activeagent:
|
|
707
|
+
concerns:
|
|
708
|
+
- has_context:
|
|
709
|
+
contextual: user
|
|
710
|
+
- has_tools: [web_search]
|
|
711
|
+
---
|
|
712
|
+
|
|
713
|
+
# Research Assistant
|
|
714
|
+
|
|
715
|
+
You are a thorough research assistant.
|
|
716
|
+
|
|
717
|
+
## Instructions
|
|
718
|
+
|
|
719
|
+
1. Analyze the research query
|
|
720
|
+
2. Search for relevant information
|
|
721
|
+
3. Synthesize findings with citations
|
|
722
|
+
|
|
723
|
+
## Task
|
|
724
|
+
|
|
725
|
+
Research the following:
|
|
726
|
+
|
|
727
|
+
{{query}}
|
|
728
|
+
|
|
729
|
+
{{#if depth == "deep"}}
|
|
730
|
+
Provide comprehensive analysis with multiple perspectives.
|
|
731
|
+
{{else}}
|
|
732
|
+
Provide a concise summary with key points.
|
|
733
|
+
{{/if}}
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
### Multi-Tool Agent
|
|
737
|
+
|
|
738
|
+
```markdown
|
|
739
|
+
---
|
|
740
|
+
name: code-reviewer
|
|
741
|
+
version: 2.1.0
|
|
742
|
+
model: anthropic/claude-sonnet-4-20250514
|
|
743
|
+
|
|
744
|
+
tools:
|
|
745
|
+
- $ref: "@activeagents/code-tools/analyze"
|
|
746
|
+
- $ref: "@activeagents/code-tools/search"
|
|
747
|
+
- name: suggest_fix
|
|
748
|
+
description: Suggest a code fix
|
|
749
|
+
inputSchema:
|
|
750
|
+
type: object
|
|
751
|
+
properties:
|
|
752
|
+
file: { type: string }
|
|
753
|
+
issue: { type: string }
|
|
754
|
+
suggestion: { type: string }
|
|
755
|
+
required: [file, issue, suggestion]
|
|
756
|
+
|
|
757
|
+
activeagent:
|
|
758
|
+
concerns:
|
|
759
|
+
- has_tools: [analyze, search, suggest_fix]
|
|
760
|
+
- streams_tool_updates: true
|
|
761
|
+
---
|
|
762
|
+
|
|
763
|
+
# Code Reviewer
|
|
764
|
+
|
|
765
|
+
You are an expert code reviewer focused on quality and security.
|
|
766
|
+
|
|
767
|
+
## Review Checklist
|
|
768
|
+
|
|
769
|
+
- [ ] Security vulnerabilities
|
|
770
|
+
- [ ] Performance issues
|
|
771
|
+
- [ ] Code style consistency
|
|
772
|
+
- [ ] Test coverage
|
|
773
|
+
- [ ] Documentation
|
|
774
|
+
|
|
775
|
+
## Task
|
|
776
|
+
|
|
777
|
+
Review the following code and provide actionable feedback:
|
|
778
|
+
|
|
779
|
+
```{{language}}
|
|
780
|
+
{{code}}
|
|
781
|
+
```
|
|
782
|
+
```
|
|
783
|
+
|
|
784
|
+
## References
|
|
785
|
+
|
|
786
|
+
- [Dotprompt](https://github.com/google/dotprompt) - Google's prompt template format
|
|
787
|
+
- [MCP](https://modelcontextprotocol.io/) - Model Context Protocol specification
|
|
788
|
+
- [AGENTS.md](https://agents.md/) - OpenAI's agent instructions format
|
|
789
|
+
- [JSON Schema](https://json-schema.org/) - Schema validation standard
|
|
790
|
+
- [Handlebars](https://handlebarsjs.com/) - Templating language
|
|
791
|
+
- [SemVer](https://semver.org/) - Semantic versioning
|
|
792
|
+
|
|
793
|
+
## Changelog
|
|
794
|
+
|
|
795
|
+
### 0.1.0-draft (2025-01-08)
|
|
796
|
+
|
|
797
|
+
- Initial draft specification
|
|
798
|
+
- Core frontmatter schema
|
|
799
|
+
- Picoschema support
|
|
800
|
+
- MCP-compatible tools
|
|
801
|
+
- Framework extension namespaces
|
|
802
|
+
- Test format definition
|
|
803
|
+
- Registry API design
|