Author and publish a managed agent
An agent is one Markdown document: optional YAML frontmatter holds settings, and the body holds instructions and resource mentions. The server is the only parser and compiler. CLI, SDK, and Studio send the exact document; do not calculate a digest or reconstruct the document from a parsed object.
Start with the no-connection support example below. Shared app and MCP connections are available when configured for your project. Shared secrets require the managed sandbox secrets capability. Test saved drafts in Studio before publishing. Signed-in users can connect personal accounts. Agent schedules follow the Live version at each occurrence.
Install the authoring skill
Download the authoring skill into your coding agent’s skill directory. For a project-local Codex installation:
The frontmatter JSON Schema validates the parsed YAML object, not the entire Markdown file. Server validation also checks resource availability, matching mentions, model choices, project ceilings, and the combined 100,000-character instruction limit.
First agent using only the CLI
Install the Sikaru CLI using the current CLI guide.
Have jq, a real project ID, and a server-side SIKARU_API_KEY available. The key
needs managed-agent write access and the run permissions required for invocation.
Keep credentials out of files and copyable examples. Use sikaru agent --help
to inspect the document authoring commands.
- Save the support example as
agent.md, or download it:
- Create the agent from the file. The CLI sends the exact text, including trailing newlines. Choose an unused slug; a conflict means inspect the existing agent, not overwrite it.
- Pull and validate the draft. Pull writes
agent.mdand returns its revision.
For later edits, use sikaru agent push support -p "$PROJECT_ID" --file agent.md --revision REVISION with the revision you actually pulled.
Push saves an existing agent; it never creates one. Save conflicts return the
newer draft so you can reconcile. Do not blindly retry with its revision.
- Review the validation and intended access. Obtain a review of the first saved draft (revision 1 for the untouched example), inspect its diff and access delta, then publish after authorization using that review’s digest:
Built-ins are enabled by default except settings explicitly disabled in the
document. The first publication acknowledges those capabilities as well as named
connections. For later publication pass the current --live-version VERSION_ID,
current revision, reviewed access digest, and the acknowledgements warranted by the reviewed delta.
Use the public document review API (POST /v1/projects/{project_id}/managed-agents/{agent_slug}/document/review)
to inspect the diff before a change. Its publication schema accepts
expectedAccessDigest to bind publication to that exact review. The CLI exposes
this through sikaru agent review and sikaru agent publish --access-digest.
Refetch and inspect review if access changes; never automatically accept a new digest.
- Run the published agent.
sikaru agent runcreates a hosted execution session, sends one turn, and streams events; without a task it opens a conversation in the terminal. Open the agent’s Conversations to see its Live session.
Tools run on Sikaru by default. Add --compute local to run them in your own
workspace instead; see Local compute.
Worked documents
These examples are structurally valid. The app and MCP examples additionally require matching shared project connections and available tools before publication. Use the actual resource slug from Connections, not a display name guessed from prose.
Support: no connections required
Shared app: connect HubSpot first
Shared MCP: connect research with its search tool first
Mentions and access
Mention syntax is @app/slug, @mcp/slug, @secret/slug, @skill/slug, or
@agent/slug. A slug starts with an ASCII letter or digit and continues with
letters, digits, underscores, or hyphens. Resource names are case-sensitive.
Mentions in fenced or inline code and escaped mentions do not grant access.
A YAML access entry must have a corresponding body mention. Adding access in
Studio inserts a mention; removing the mention removes access on publication.
Each access entry accepts ownership, tools, and policy (allow,
require_approval, or deny). Omitting tools selects the connection’s current
catalog and pins it at publication; explicit tools: [] selects no tools. Use an
explicit tool list to narrow access. deny remains a denial, not an approval
prompt. App connections and secrets support shared or personal ownership;
MCP connections use shared ownership. Personal ownership resolves the signed-in
runner’s own account, never another member’s account.
The validator reports resolved-shared, resolved-personal, unresolved, ambiguous,
broken, or blocked. Unresolved, ambiguous, broken, and blocked resources need
attention before Go live. An intentional changed tool definition must be reviewed
and explicitly acknowledged to pin the new definition. Revoked tools never
silently fall back to another connection or search provider.
Built-ins are web search, web fetch, code execution (bash), workspace files
(workspace), memory, and subagents (agents). All default on within project
ceilings. Frontmatter also supports model, budget, web, setup, and embedded
sources; consult the schema. The server refuses unknown keys. A schema pass
alone is not permission to use a resource.
Draft, Go live, and suggested changes
Saving a draft leaves live behavior unchanged. Go live publishes a new version; removing or widening access requires explicit confirmation. Existing sessions keep their pinned instructions, but removed access stops on their next turn. Versions record author and time; review a diff before reverting and confirm the real revert operation. A stale save or publication is refused.
Evolve and Improvements may suggest prose changes. They cannot add or remove mentions or change access settings. Accepting a suggestion creates a labelled suggested draft, never overwrites your draft, and never goes live directly. Adopt or dismiss it, then review and publish through the same human Go live flow.
Shared conversations show messages and tool calls to project members; model
reasoning is hidden and secrets are redacted. Once a session uses a personal
connection or secret, its entire conversation is readable in full only by its
runner. Other members see its status and usage. A project-key request’s user_id
is a caller label and does not authenticate a Sikaru user.
Secrets and personal accounts
Never put a real secret in frontmatter or instructions. Create a shared or personal secret in
Connections with a write-only value and exact allowed hosts, then mention its
slug, for example @secret/apollo. Validation remains blocked if managed sandbox
secrets are not configured. A local compute session receives no placeholders and
reports that secrets need the managed sandbox.
In managed sandbox code, read the nonsecret placeholder by its exact slug:
The placeholder stays stable within a session, including after value rotation.
Only request headers to currently allowed HTTPS hosts receive the real value.
Other destinations are refused, redirects are not followed, and echoed values
are redacted from response headers and streaming bodies. Body substitution is
not supported. Removing a mention, revoking its connection, or narrowing hosts
removes that reach from existing sessions too. A require_approval secret pauses
each outbound request for its own decision in the ordinary pending-actions and
approval APIs; denying that request never reveals the value. Approval does not
grant later requests.
Personal connections belong to each signed-in runner; missing accounts prompt the runner to connect and resume. Scheduled calls use the authority described below. Channels and inbound webhook triggers are outside this authoring flow.
Test a saved draft
In Studio, enter a Test message and choose Test current draft. Studio saves
pending edits and pins that exact revision. Review and acknowledge any added or
changed access. The test runs as the signed-in tester, appears in Conversations
labelled Draft, and keeps memory and workspace files separate from Live.
Testing never activates the candidate or changes existing Live instructions.
Unresolved, broken, or ceiling-blocked mentions name the issue and refuse the test.
Authorized project members share access to shared connection slots. Personal
accounts resolve as the signed-in tester. A missing account pauses the turn so
the tester can connect and resume; a project-key run fails that personal call
with needs_signed_in_user and continues without borrowing an account.
From the public API, create an execution session with environment: "draft" and
draft_revision set to the saved revision. Set acknowledge_widening: true only
after reviewing its access changes. Pass the review’s accessDigest as
expected_access_digest to refuse a changed tool or host snapshot. Project-key requests still require tenant_id
and user_id; those labels do not authenticate a person. Then append a turn and
read its events as for a Live session. A stale revision returns HTTP 409.
The separately installed authoring companion tests the same saved document:
Add --acknowledge-widening after reviewing added or changed access. dev accepts
an existing agent slug and saved revision; it creates no temporary agent. Use the
server document import operation to turn files into a document, then save that
exact document through the revision-checked authoring workflow above. init and
check retain their existing directory manifest interface.
Hosted invocation snippets
These examples are generated from the same source as Studio and agent snippets.
Replace PROJECT_ID with your project. The agent slug here is support; fetch
snippets for your actual agent after Go live. No example contains an API key.
cli
curl
python
typescript
Existing directory authors
The explicit sikaru.json file-tree manifest remains supported by the separately
installed sikaru-authoring companion and Python sikaru_authoring.compile_directory.
It packages only listed files and rejects symlinks, traversal, duplicates, and
invalid definitions. Use that existing contract for directory integrations; do
not pass a directory digest as an agent document. Document agents use the single
file workflow above. Legacy directory release changesets retain their existing
review and staging/production operations; document suggestions require Go live.
Troubleshooting
- Unknown key or invalid YAML: fix the line and column reported by validation.
- Unresolved or ambiguous mention: connect or choose the exact resource in Connections.
- Broken mention: reconnect, or review a changed tool definition before republishing.
- Blocked capability: inspect the project’s ceiling and available capabilities.
- HTTP 409: read the current draft/live version and reconcile; never force an overwrite.
- HTTP 402: check credits, the organization’s monthly spend limit and the agent’s spending cap in Billing. Signing in again does not fix billing.
- HTTP 503 or interrupted create: inspect the existing slug and receipt before retrying; do not create replacement identities to bypass an uncertain result.
- No events yet: creation alone is not a completed turn. Inspect the returned run and stream status before claiming the agent answered.
Schedule the live agent
Create an agent schedule with POST /v1/projects/{project_id}/run-schedules:
Choose cron with an IANA timezone, or interval_seconds (60 through 2592000).
The default fresh mode starts a conversation each time. persistent continues
one conversation and adopts the live document, model and access at its next turn.
A running or not-yet-delivered previous occurrence causes a recorded overlap skip.
Missed times coalesce into one occurrence, then the next future time is scheduled.
List with GET /v1/projects/{project_id}/run-schedules?agent_slug=support.
Each schedule includes its next run time. Read /{schedule_id}/occurrences for
admitted and skipped times, exact version and sealed access; use nextBefore as
before to retrieve older entries. Read /{schedule_id}/notices for actionable
owner notices. Pause or resume with PATCH /{schedule_id} and {"paused": true}
or {"paused": false}; delete with DELETE /{schedule_id}. Occurrence receipts
remain after deletion. The Studio offers these same operations under Triggers.
A signed-in creator uses personal connections only when they published the current
live version. A different publisher produces needs_schedule_owner_confirmation;
a missing account produces personal_connection_missing. Those tool calls fail,
the creator receives a notice, and the rest of the run continues. Project-key
schedules never acquire a human identity or borrow the publisher’s account.
Confirmed membership removal pauses a human creator’s schedule and records an
administrator notice. An unavailable membership service defers admission.
Existing unsigned API schedules using session_id retain their pinned session contract.
Sessions carrying a signed-in identity must use an agent_slug schedule so each
occurrence receives current membership and personal-access checks. Retained
identity-bearing session schedules pause with a notice instead of running.
Conversation channels
Managed agents can start with HTTP or a configured Slack room/personal DM. HTTP is the default for older creation clients. Slack setup lives in Settings → Channels; tool Connections remain separate. A channel never grants personal connection authority. Publication and explicit channel activation are separate actions. See Managed-agent channels for setup and lifecycle.
