Create Agent
Agents
Create Agent
POST
Create Agent
Use this API to create a new custom agent configuration. The engine stores the agent in Firestore and writes version 1 to the agent’s versions subcollection. The schema uses
Required when
MCP servers (
When
4. Agent that verifies content against an MCP server (
Errors:
.passthrough(), so any additional behavioral fields are forwarded to the service layer.
Endpoint
POST https://api.velt.dev/v2/agents/create
Headers
string
required
Your API key.
string
required
Your Auth Token.
Body
Params
object
required
Server-managed fields
The following fields are owned by the server and are rejected with a400 INVALID_ARGUMENT if present on the create or update-version payload:
id, version, createdAt, and updatedAt are likewise server-generated. Sending a reserved key returns one error per offending key, e.g. metadata.internal is a server-managed field and cannot be set via the API.
Context gathering strategies
Context gathering strategy options
Per-strategy overrides are supplied undercontextGathering.strategyOptions["<strategy>"]. All are optional unless noted.
rest-api strategy options
Required when strategies includes "rest-api". Each configured endpoint is fetched at execution time and the resolved URL + description + JSON-stringified response is injected into the prompt via the {{restApiData}} template variable.
RestApiEndpoint fields:
auth shapes:
Auth secret handling (redaction-on-read):
token, password, and header values are encrypted before the Firestore write and are never returned to clients. On read (Get / List Agents), encrypted secret fields are replaced with "__redacted__". To rotate a secret, send the new plaintext value on update; to keep an existing secret, omit the field.MCP servers (mcp-tools strategy)
When execution.executionStrategy is "mcp-tools", the agent runs a model-driven tool loop: at execution time the engine connects to each remote MCP (Model Context Protocol) server declared in execution.mcpServers, lists its tools, exposes them to the model, and runs a multi-turn call→tool→call loop until the model emits a final structured response. This is how the built-in docs code-verification agent checks snippets live against the Velt docs MCP instead of a pre-ingested corpus.
The
"mcp-tools" strategy is provider-agnostic (works on both Claude and Gemini) and requires a non-empty top-level instructions field and at least one entry in execution.mcpServers. Omitting either fails validation.execution.mcpServers is an array of 1–5 server objects (MCP_MAX_SERVERS = 5). Each server object is strictly validated (unknown keys rejected):
auth shapes (identical to the rest-api strategy):
Auth secret handling (redaction-on-read): MCP
token, password, and header values are encrypted before the Firestore write (using an MCP-specific encryption salt) and are never returned to clients. On read (Get / List Agents, List Versions), encrypted secret fields are replaced with "__redacted__". To rotate a secret, send the new plaintext value on a version update; to keep an existing secret, omit the field.AI config (provider / model)
Bothexecution.aiConfig and contextGathering.aiConfig accept the same strictly-validated object, letting an agent override the AI provider/model used for that phase. Unknown keys are rejected.
Execution strategy options
execution.strategyOptions["<strategy>"] carries per-strategy runtime overrides. The stagehand-agent strategy accepts:
When using
stagehand-agent, set contextGathering.strategies: ["none"]; the agent handles navigation, interaction, and extraction itself.Knowledge (Memory-RAG)
execution.knowledge pulls workspace knowledge from Velt Memory into the prompt. Strictly validated. Only these four fields are accepted:
Response Descriptions
All fields are optional strings that instruct the AI on how to populate each finding field:Example Requests
1. Minimal agent
2. Full custom agent with cross-page execution and Memory-RAG
3. Agent with live REST API context
4. Agent that verifies content against an MCP server (mcp-tools)
Response
Success Response
Failure Response
INVALID_ARGUMENT (Zod validation failure, e.g. missing name, missing apiKey, a server-managed field, an unknown key inside knowledge, an invalid userContextFields.type, missing instructions for an AI/stagehand-agent/mcp-tools strategy, or missing/invalid execution.mcpServers when executionStrategy is "mcp-tools") / RESOURCE_EXHAUSTED (workspace already has the maximum number of custom agents).

