Agents
An agent profile binds together a SkillVersion, a tool scope, a set of credential bindings, an optional budget, and an optional compute provider override. Per Decision 0007, agent versions are monotonic integers (@1, @2, ...) — every change to the profile is a new version.
Spec shape
{
"name": "research-agent", // workspace-unique
"skill_version_id": "cm...", // must belong to the same workspace
"tool_scope": ["web_search", "github.*"], // tool patterns this agent may use
"credential_bindings": [ // per Decision 0013
{
"name": "GITHUB_TOKEN",
"scope": "proxy", // "proxy" (default) | "direct"
"vault_ref": "workspace-vault/github",
"ttl_seconds": 300, // only meaningful for "direct"
"used_by_tools": ["github.*"] // optional; helps the proxy router
}
],
"budget": {
"cost_usd": 1.50,
"tool_calls": 25,
"duration_s": 600
},
"compute_provider_config_id": "cm..." // optional Decision 0011 override
}
credential_bindings follow the proxy-default + direct-fetch-opt-in model from Decision 0013. Proxy scope means the MCP tool transport carries the credential; the agent never sees it. Direct scope returns the secret over HTTPS with a TTL; requires the skill to declare requires_direct_secrets in its frontmatter.
GET /api/v1/workspaces/{slug}/agents
List agents in a workspace.
{
"agents": [
{
"id": "cm...",
"name": "research-agent",
"created_at": "...",
"latest_version": 5,
"version_count": 5,
"skill_uri": "[email protected]",
"tool_scope": ["web_search"]
}
]
}
POST /api/v1/workspaces/{slug}/agents
Create an agent. Body is the spec above. The agent is created at version 1 and marked latest.
Requires admin or owner role. Honours Idempotency-Key.
Response 201:
{
"agent": { "id": "cm...", "name": "research-agent", "latest_version": 1, ... },
"version": { "id": "cm...", "version": 1, "is_latest": true, "created_at": "..." },
"uri": "harmony://ws/groupany/agents/research-agent@1"
}
Errors:
| Status | Code | When |
|---|---|---|
404 | resource_not_found | skill_version_id doesn't exist in this workspace |
409 | name_taken | Agent name already exists — create a new version instead |
POST /api/v1/workspaces/{slug}/agents/invent
Draft an agent from a one-line description. A BYO model writes the SKILL.md
(name, instructions, model), picks the tools it genuinely needs from the
workspace's palette (built-in + installed MCP), and proposes guardrails — any
sending/posting/deleting action lands in ask_first. Requires admin/owner.
Body: { description: string, model?: string, create?: boolean }.
createomitted/false → returns the draft to review and edit before saving.create: true→ also builds the skill + agent (with a default avatar) and returns it.
curl -X POST https://platform.groupany.ai/api/v1/workspaces/groupany/agents/invent \
-H "Authorization: Bearer $HARMONY_KEY" -H "Content-Type: application/json" \
-d '{"description":"Reviews pull requests on our Gitea repos and comments on the PR","create":true}'
Response (200 for a draft, 201 when created):
{
"draft": {
"name": "gitea-pr-reviewer",
"model": "claude-sonnet-4-6",
"description": "Reviews PRs and posts a comment",
"instructions": "You are a senior engineer reviewing pull requests…",
"tools": ["gitea_pr_diff", "gitea_pr_comment"],
"guardrails": { "never": ["merge a PR"], "ask_first": ["post a review comment"] }
},
"created": true,
"agent": { "name": "gitea-pr-reviewer" },
"uri": "harmony://ws/groupany/agents/gitea-pr-reviewer"
}
GET /api/v1/workspaces/{slug}/agents/{name}
Agent detail plus all versions, latest first.
{
"agent": { ... },
"versions": [
{
"id": "cm...",
"version": 5,
"is_latest": true,
"created_at": "...",
"tool_scope": ["web_search", "github.*"],
"credential_bindings": [ ... ],
"budget": { "cost_usd": 1.5, "tool_calls": 25 },
"compute_provider_config_id": null,
"skill_version": {
"name": "research-a-topic",
"version": "0.3.1",
"uri": "[email protected]"
}
}
]
}
GET /api/v1/workspaces/{slug}/agents/{name}/versions
Same as above but versions only (no agent envelope).
POST /api/v1/workspaces/{slug}/agents/{name}/versions
Create a new agent version. Body is the spec above without the name field — the URL path identifies the agent.
The new version's integer is auto-assigned (latest + 1). Marks any prior isLatest = true row as not latest in the same transaction.
Response 201:
{
"version": { ... },
"uri": "harmony://ws/groupany/agents/research-agent@6"
}
Errors:
| Status | Code | When |
|---|---|---|
404 | not_found | Agent name doesn't exist — create it via POST /agents |
404 | resource_not_found | The new skill_version_id doesn't exist in this workspace |
GET /api/v1/workspaces/{slug}/agents/{name}/versions/{version}
Fetch a specific version. {version} accepts an integer or the literal latest.
{
"version": { ... },
"uri": "harmony://ws/groupany/agents/research-agent@5"
}
Errors:
| Status | Code | When |
|---|---|---|
404 | version_not_found | Either the agent or that exact version doesn't exist |