Docyrus Agent Design
Build a custom AI agent with docyrus agent, then validate its configuration and test that it's well-formed. An agent is a row in tenant_ai_agent (identity + model + capability config) plus a set of sub-resources (tools, data sources, docs, MCPs, connections, dynamic contexts, workflow steps, deployments). This skill is the design workflow; the platform's conceptual capability catalog lives in docyrus-platform (references/ai-capabilities.md), and exhaustive CLI flags are available via docyrus agent <sub> --help (command index: docyrus-cli-app).
Workflow
-
Confirm app + auth. Agents are dev-app scoped.
docyrus auth who --json docyrus apps list --json # target appSlug / appId -
Design the agent. Decide its shape (is it a conversational assistant, a callable skill, or a workflow agent?), its instructions, its default/backup models, and which capabilities it needs (tools? data sources? files? knowledge base? web search?). Toggle a capability on before attaching the matching sub-resource. See references/agent-model.md to map intent → fields.
-
Create the agent. The only required field is
--skillName. Set identity + model + capability toggles in the same call. See Create. -
Attach sub-resources in this order (each is its own command group, see Sub-resources):
- data-sources the agent can read/write (turn on
--supportDataSourcesfirst), - tools the agent can call (turn on
--supportTools; author the tool first with docyrus-app-ai-tools, then attach it here), - docs (knowledge; turn on
--supportKnowledgeBase), mcps, connections (forward/subagent), dynamic-contexts, - workflow-steps (only if
--hasWorkflow), then deployments (+ deployment-tools / deployment-data-sources).
- data-sources the agent can read/write (turn on
-
Validate — re-read the agent and each sub-resource list; confirm config + attachments landed. See Validate.
-
Test — confirm the agent is well-formed (lists cleanly, references resolve) and, where possible, exercise it. See Test.
A full worked example (assistant with a data source, an attached tool, and a knowledge doc) is in references/workflow-examples.md.
Command cheat-sheet
Selectors: --appId | --appSlug, --agentId. Sub-resource row id is the generic --id (not --toolId/--dataSourceId). Deployment-nested groups also need --deploymentId. Write commands take camelCase flags or --data/--from-file JSON (flags merge over JSON; API keys are snake_case). Append --json.
Create an agent
docyrus agent create --appSlug crm \
--skillName "deal_coach" --name "Deal Coach" --agentName "deal-coach" \
--description "Helps reps qualify and advance deals" \
--instructions "You are a CRM assistant. Be concise. Use the deals data source to answer." \
--isAssistant true --mode conversation \
--supportTools true --supportDataSources true --supportKnowledgeBase true --json
# → capture data.id as AGENT_ID
⚠️ Known backend issue (verified on env=dev).
agent createcurrently fails withcannot insert a non-DEFAULT value into column "name". The dev create service (apps/api/src/dev/app/agent.service.tscreateAgent) insertsname, buttenant_ai_agent.nameis a generated column (GENERATED ALWAYS AS (COALESCE(agent_name, skill_name)) STORED) — Postgres rejects any explicit insert into it, regardless of flags. Until the service stops insertingname, agents can't be created via this endpoint. The flag/usage below is correct and will work once fixed; in the meantime, operate on agents created through another path. The flag values themselves are unaffected — Postgres derivesnamefromagent_name/skill_name.
--skillNameis the only required field. Everything else is optional with server defaults (mode→conversation,ownership→CUSTOM,status→1,is_agent→true,is_assistant/is_skill→false,memory_token_limit→4000).- Identity:
--name(display),--agentName(internal),--description,--category,--welcomeMessage. - Models:
--defaultAiModelId,--backupAiModelId,--cotAiModelId,--defaultReasoningLevel,--temperature,--maxTokens. Model ids are free-form FK strings (no enum) — resolve a realcore_ai_modelid, don't invent one. - Shape toggles:
--isAgent,--isAssistant,--isSkill,--hasWorkflow,--multipleDeployment,--jsonOutput. - Capability toggles gate the sub-resources:
--supportTools,--supportDataSources,--supportFiles,--supportKnowledgeBase,--supportWebSearch. Turn the relevant one on before attaching. --ownershipenum isAPP | CUSTOM | PRODUCT | SYSTEM | USER(defaultCUSTOM). ⚠️ The flag help text saysSYSTEM | APP | TENANT— that is wrong;TENANTis not valid.- JSON-only config (schemas, memory options) goes via
--data:instruction_schema,input_form_schema,output_render_schema,memory_options, plus the long tail in references/agent-model.md.
Sub-resources
Each group supports list/get/create/update/delete (a few exceptions noted). Always pass app + --agentId; the row is --id.
docyrus agent data-sources create --appSlug crm --agentId AGENT_ID --tenantDataSourceId <ds-id> --privilege read --json
docyrus agent tools create --appSlug crm --agentId AGENT_ID --coreAiToolId <tool-id> --json # define <tool-id> first via apps ai-tools (docyrus-app-ai-tools)
docyrus agent docs create --appSlug crm --agentId AGENT_ID --title "Pricing FAQ" --content "..." --json
docyrus agent mcps create --appSlug crm --agentId AGENT_ID --tenantMcpServerId <id> --json
docyrus agent connections create --appSlug crm --agentId AGENT_ID --connectedAiAgentId <id> --connectionType subagent --json
docyrus agent dynamic-contexts create --appSlug crm --agentId AGENT_ID --name "Today" --systemMessage "..." --json
docyrus agent workflow-steps create --appSlug crm --agentId AGENT_ID --name "Step 1" --type prompt --inputSchema '{}' --outputSchema '{}' --json
docyrus agent deployments create --appSlug crm --agentId AGENT_ID --name "Production" --json
docyrus agent list --appSlug crm --json
docyrus agent get --appSlug crm --agentId AGENT_ID --json
The full sub-resource table (required-on-create fields, createOnly fields, enums) is in references/agent-model.md.
Critical rules
- Only
--skillNameis required to create an agent. Don't over-specify; rely on server defaults and add what the use case needs. - Capability toggle before attachment. Attaching a data source/tool/knowledge doc without turning on the matching
--support*flag leaves the agent unable to use it. Set the toggle oncreate(orupdate) first. --ownershipvalid values areAPP | CUSTOM | PRODUCT | SYSTEM | USER(defaultCUSTOM); the flag help is inaccurate.- Tools are a two-step, separate flow.
docyrus agent tools create --coreAiToolId <id>only attaches an existing app-scoped tool (atenant_ai_tool/core_ai_tool) to the agent. You define the tool first viadocyrus apps ai-tools— see docyrus-app-ai-tools. - Sub-resource rows use
--id, not--toolId/--dataSourceId(deliberate, to avoid clashing with body flags).createOnlyfields (--coreAiToolIdon tools,--tenantDataSourceIdon data-sources) are rejected onupdate;--archivedis update-only. agent tasksandagent recurring-tasksare non-functional against the current backend (no matching dev routes → 404, verified:Cannot GET …/agents/:id/tasks). Don't design around them; schedule recurring work with an automationrecurrencetrigger (docyrus-automation-design) instead.- Sub-resource
createops need an agent you can see under RLS. Sub-resource creates run inside an RLS-enforced write transaction that re-checks the agent viaagentExists(id + tenant + app). An agent owned by another user (or with a null owner) is invisible there and the create returns 404 "resource not found" — even thoughlist/get(broader reads) show it. Operate on agents you own. (Sub-resourcelistops are verified working;createhappy-path is currently gated by the create bug above.) agent get/list/create/uploadetc. don't error on extra JSON keys — sub-resource "required on create" fields (e.g.title,name,core_ai_tool_id,connection_type) are enforced by the backend DTO, so a missing one returns a server error, not a CLI complaint. Read back to confirm.- Model/data-source/tool ids are real FKs, not enums — resolve them (e.g. from
list-data-sources,apps ai-tools list) before attaching; a fabricated id fails server-side. - Validate then test, every time. Re-read the agent + sub-resource lists. Delete throwaway agents you create.
Validate
docyrus agent get --appSlug <app> --agentId <id> --json— confirm identity, models,mode,ownership, and that each--support*toggle is set as intended.- For each attached kind:
docyrus agent data-sources list …,docyrus agent tools list …,docyrus agent docs list …, etc. — confirm the attachments exist and reference the right ids. - If
--hasWorkflow:docyrus agent workflow-steps list …— confirm steps, theirtype, andparent/sort_ordersequencing. - If deployed:
docyrus agent deployments list …and the deployment-tools/data-sources lists.
Per-field "what correct looks like" is in references/workflow-examples.md.
Test
- Well-formed check: every list above returns the expected rows and every referenced id resolves (no dangling FK). The agent
getshows capability toggles consistent with its attachments. - Exercise it where a path exists — invoke the agent from an automation
ai-agentnode (docyrus-automation-design) or the app's chat surface, give it a prompt that needs an attached data source/tool, and confirm it uses them. - Clean up: delete throwaway sub-resources, then
docyrus agent delete --appSlug <app> --agentId <id> --json.
Full test playbook in references/workflow-examples.md.
References
- references/agent-model.md — Agent fields grouped by purpose (identity, models, shape, capabilities, render/output, memory, multi-agent), the enum values and server defaults, and the full sub-resource table (groups, required-on-create, createOnly, enums).
- references/workflow-examples.md — End-to-end worked agent (assistant + data source + tool + knowledge doc), validation checklist, test playbook.
- docyrus-platform →
references/ai-capabilities.md— what the agent builder can do. docyrus-cli-app — CLI command index;docyrus agent <sub> --helpfor exhaustive flags. docyrus-app-ai-tools — author the AI tools an agent calls (apps ai-tools); attach them to the agent here withagent tools create --coreAiToolId.