Publish an agent definition
const url = 'https://example.com/v1/agents';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"id":"example","version":"example","name":"example","description":"example","projectId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","instructions":{"prompt":"example","version":"example"},"parameters":[{"name":"example","description":"example","type":"string","required":true,"default":"example"}],"settings":[{"id":"example","version":"example"}],"modelSettings":{"id":"example","version":"example"},"capabilities":[{}],"tools":[{"id":"example","version":"example"}],"retrieval":[{"source":"facts","types":["example"],"roles":["user"],"scope":"same-conversation","limit":1,"mode":"keyword"}],"memory":{"instructionTypes":["example"],"remember":{"types":["example"],"scope":"same-user","keepDays":1}},"files":{"update":true,"create":true},"guardrails":["example"],"preferredProvider":"example","preferredModel":"example","conversationPolicy":{"historyLimit":1,"hitlAfterTurns":1,"hitl":{"afterTurns":1,"tools":{"default":"never_ask","overrides":{"additionalProperty":"never_ask"}},"defaultReviewerRole":"standard","separateApprover":{"default":true,"overrides":{"additionalProperty":true}},"timeoutMs":1,"onTimeout":"escalate"}},"budget":{"maxSteps":1,"maxCostUsd":1,"maxWallMs":1},"tags":["example"],"output":{"schema":{},"name":"example","maxRepairs":1},"toolErrors":{"maxRetries":1,"retryOn":["invalid-arguments"]},"parallelToolCalls":true,"mcp":{"expose":true,"readOnly":true,"destructive":true}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/agents \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "id": "example", "version": "example", "name": "example", "description": "example", "projectId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "instructions": { "prompt": "example", "version": "example" }, "parameters": [ { "name": "example", "description": "example", "type": "string", "required": true, "default": "example" } ], "settings": [ { "id": "example", "version": "example" } ], "modelSettings": { "id": "example", "version": "example" }, "capabilities": [ {} ], "tools": [ { "id": "example", "version": "example" } ], "retrieval": [ { "source": "facts", "types": [ "example" ], "roles": [ "user" ], "scope": "same-conversation", "limit": 1, "mode": "keyword" } ], "memory": { "instructionTypes": [ "example" ], "remember": { "types": [ "example" ], "scope": "same-user", "keepDays": 1 } }, "files": { "update": true, "create": true }, "guardrails": [ "example" ], "preferredProvider": "example", "preferredModel": "example", "conversationPolicy": { "historyLimit": 1, "hitlAfterTurns": 1, "hitl": { "afterTurns": 1, "tools": { "default": "never_ask", "overrides": { "additionalProperty": "never_ask" } }, "defaultReviewerRole": "standard", "separateApprover": { "default": true, "overrides": { "additionalProperty": true } }, "timeoutMs": 1, "onTimeout": "escalate" } }, "budget": { "maxSteps": 1, "maxCostUsd": 1, "maxWallMs": 1 }, "tags": [ "example" ], "output": { "schema": {}, "name": "example", "maxRepairs": 1 }, "toolErrors": { "maxRetries": 1, "retryOn": [ "invalid-arguments" ] }, "parallelToolCalls": true, "mcp": { "expose": true, "readOnly": true, "destructive": true } }'Body is a full defineAgent spec. Server validates via @kindgi/agents.defineAgent before persisting.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”Full defineAgent spec. Validated server-side via @kindgi/agents.defineAgent — validation failures return 400 validation-failed with the issue list under details.issues.
object
Responses
Section titled “Responses”Agent published.
object
Examplegenerated
{ "agentId": "example", "version": "example", "warnings": [ { "code": "example", "message": "example" } ], "planWarning": { "flows": { "plan": 1, "most": 1, "inUse": 1 }, "agents": { "plan": 1, "most": 1, "inUse": 1 } }}Validation failed (see details.issues); or projectId isn’t a project id (a UUID). Or reference-out-of-scope: a tool, guardrail or data block it names isn’t registered in its project, its org or the workspace (details.issues, each with path, kind and id).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Missing / malformed / expired / revoked bearer token.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}permission-denied: the caller may not make this change. Or plan-limit-reached: this adds flows or agents to production past the most this runtime’s license key runs, so none of them is added; what runs keeps running. details has projectId (on a reinstate, when its version records one); over, each count over (flows first) with its limit (flows or agents), the number it adds (adding), and the key’s plan, most and inUse when they count this workspace alone; the first of them again at the top (details.limit, …); newIds, the flows and agents it adds; and next, where a larger plan is, when the runtime names one. Without an authorization store, key-project-mismatch (details.keyProjectId): the API key or session is limited to a project, and this writes above it, to the workspace, an org or a team (with a store, that is permission-denied).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}The body’s projectId names no project of this workspace (project-not-found).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}agent-already-registered: that (id, version) is taken. Or agent-project-mismatch: the agent’s versions live in another project (an agent belongs to the project its first version was published into and never moves, though in a workspace with environment orders a version may be made in another project of that project’s order; the message doesn’t name the project). Or environment-takes-promotions: the project is a later environment of an environment order, which takes builds only by promotion from the one before it; publish in the order’s first environment instead (details.firstProjectId, when you can read that project; details.position, the project’s place from 0). Nothing is written. Or registry-read-only: this registry takes no writes (under kindgi dev, the pack’s files are the source); the message says what to do instead. Or idempotency-key-in-flight (with Retry-After): a request with the same Idempotency-Key still runs, so this one wasn’t run; send it again after Retry-After to get that request’s answer.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”The request body is over the API’s limit (request-too-large; details.maxBytes says how much).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}rate-limit-exceeded with details.limit: "schema-compile-time", on a server with a compile budget (Kindgi Cloud): this workspace’s schemas spent details.budgetMs compiling in the last 60 seconds. Nothing was stored; Retry-After says when to send it again. Or rate-limit-exceeded with details.limit: "api-requests", on a runtime that sets workspace limits (Kindgi Cloud): this workspace’s limit on API requests a minute is reached, so the request wasn’t run; Retry-After says when to send it again.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”Server error (unmapped domain code or framework crash).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}plan-count-busy (with Retry-After): counting the flows and agents in production took too long, so none of them is added; a retry is safe. Or idempotency-store-unavailable (with Retry-After): the Idempotency-Key store couldn’t be read before the request ran, so nothing was changed. Or the authorization store couldn’t be reached (authz-backend-unavailable, with Retry-After), or the database was too busy for the authorization check (database-busy, with Retry-After), so the request wasn’t run. Or tenant-state-unavailable (with Retry-After), on a runtime serving many workspaces: the workspace’s state couldn’t be read, so nothing was changed.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”See also
GET /v1/agents: List agents- Plan limits
- Agent and tool versions
- Ask before a tool runs
- Error code
agent-already-registered - Error code
agent-project-mismatch - Error code
authz-backend-unavailable - Error code
database-busy - Error code
environment-takes-promotions - Error code
idempotency-key-in-flight - Error code
idempotency-store-unavailable - Error code
key-project-mismatch - Error code
permission-denied - Error code
plan-count-busy - Error code
plan-limit-reached - Error code
project-not-found - Error code
rate-limit-exceeded - Error code
reference-out-of-scope - Error code
registry-read-only - Error code
request-too-large - Error code
tenant-state-unavailable - Every error code