docs: fix agent.json examples to match current schema (#6878)
Replace outdated node_id/edge_id with id, wrap nodes/edges under graph key, add goal section with success_criteria. Matches what load_agent_export() and NodeSpec actually expect. Fixes #897 Co-authored-by: Jose37456 <Jose37456@users.noreply.github.com>
This commit is contained in:
+53
-40
@@ -198,33 +198,44 @@ Use the coder-tools MCP tools from your IDE agent chat (e.g., initialize_and_bui
|
||||
|
||||
If you prefer to build agents manually:
|
||||
|
||||
```python
|
||||
# exports/my_agent/agent.json
|
||||
```jsonc
|
||||
// exports/my_agent/agent.json
|
||||
{
|
||||
"goal": {
|
||||
"agent": {
|
||||
"id": "my_agent",
|
||||
"name": "Support Ticket Handler",
|
||||
"version": "1.0.0",
|
||||
"description": "Process customer support tickets"
|
||||
},
|
||||
"graph": {
|
||||
"id": "my_agent-graph",
|
||||
"goal_id": "support_ticket",
|
||||
"entry_node": "analyze",
|
||||
"terminal_nodes": ["analyze"],
|
||||
"nodes": [
|
||||
{
|
||||
"id": "analyze",
|
||||
"name": "Analyze Ticket",
|
||||
"description": "Categorize and prioritize the support ticket",
|
||||
"node_type": "event_loop",
|
||||
"system_prompt": "Analyze this support ticket...",
|
||||
"input_keys": ["ticket_content"],
|
||||
"output_keys": ["category", "priority"]
|
||||
}
|
||||
],
|
||||
"edges": []
|
||||
},
|
||||
"goal": {
|
||||
"id": "support_ticket",
|
||||
"name": "Support Ticket Handler",
|
||||
"description": "Process customer support tickets",
|
||||
"success_criteria": "Ticket is categorized, prioritized, and routed correctly"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"node_id": "analyze",
|
||||
"name": "Analyze Ticket",
|
||||
"node_type": "event_loop",
|
||||
"system_prompt": "Analyze this support ticket...",
|
||||
"input_keys": ["ticket_content"],
|
||||
"output_keys": ["category", "priority"]
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"edge_id": "start_to_analyze",
|
||||
"source": "START",
|
||||
"target": "analyze",
|
||||
"condition": "on_success"
|
||||
}
|
||||
]
|
||||
"success_criteria": [
|
||||
{
|
||||
"id": "sc-categorized",
|
||||
"description": "Ticket is categorized and prioritized correctly"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -532,16 +543,17 @@ def my_custom_tool(param1: str, param2: int) -> Dict[str, Any]:
|
||||
# Implementation
|
||||
return {"result": "success", "data": ...}
|
||||
|
||||
# Register tool in agent.json
|
||||
# Register tool in agent.json (inside "graph" → "nodes")
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"node_id": "use_tool",
|
||||
"node_type": "event_loop",
|
||||
"tools": ["my_custom_tool"],
|
||||
...
|
||||
}
|
||||
]
|
||||
"graph": {
|
||||
"nodes": [
|
||||
{
|
||||
"id": "use_tool",
|
||||
"node_type": "event_loop",
|
||||
"tools": ["my_custom_tool"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -560,15 +572,16 @@ def my_custom_tool(param1: str, param2: int) -> Dict[str, Any]:
|
||||
}
|
||||
}
|
||||
|
||||
# 2. Reference tools in agent.json
|
||||
# 2. Reference tools in agent.json (inside "graph" → "nodes")
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"node_id": "search",
|
||||
"tools": ["web_search", "web_scrape"],
|
||||
...
|
||||
}
|
||||
]
|
||||
"graph": {
|
||||
"nodes": [
|
||||
{
|
||||
"id": "search",
|
||||
"tools": ["web_search", "web_scrape"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user