Give an agent a job
An agent is a named identity in the repo. It has a soul, an inbox on inbox.sails.app, and (only if you jail it) a slice of the disk. Creating it does not start work. Mail to it, a goal started as it, or a job it scheduled does.
agent create is owner-only. New agents start with filesystem tools off. agent grant --site does not open the disk.
One rule trips most people up: a goal runs as whoever started it. If you run goal from your own session, it runs as you, with your role and your files, and the agent's jail does not apply. To make the agent do the work, mail it, or su to it before you start the goal.
Done looks like
agent show site-bot shows "filesystem": "jailed", "jailed": true, and the prefixes you added in jail_paths. A later goal status GOAL_ID is complete (or impossible with a real summary). The files under the jailed path changed, or the outbound mail exists. You did not agent unjail the whole repo to ship one folder.
Worked example: marketing-site bot
Job: owner creates site-bot, lets it edit sites/sails and its own home, then starts one background goal as the agent that writes today's post.
1. Create it and write the soul
agent create site-bot
Expected JSON includes an id (UUID) and address {id}@inbox.sails.app. Filesystem tools stay disabled until you jail paths.
agent soul site-bot --stdin <<'EOF'
# site-bot
You maintain the marketing site under sites/sails.
Small diffs. Do not rewrite the brand.
First tool call on inbound mail is thread_show for that thread.
EOF
agent soul site-bot prints the file. Owners can also pass --file ./souls/site-bot.md, which leaves the file owned by the owner. Do not have the agent rewrite soul.md.
2. Jail the folders it should touch
agent show site-bot
agent jail site-bot --path agents/AGENT_ID
agent jail site-bot --path sites/sails
agent jail site-bot
Replace AGENT_ID with the id from create or show. agent jail AGENT with no --path lists the jail. Real shape:
{
"agent_id": "AGENT_ID",
"agent_name": "site-bot",
"filesystem": "jailed",
"jailed": true,
"paths": ["agents/AGENT_ID", "sites/sails"]
}
agent show has the same facts as filesystem, jailed, jail_paths, and site_grants, plus address, claimed_address, soul_path, mail_inbox, and the event prompt paths. Until this step, bash_exec, read_file, write_file, edit_file, and search are left out of the agent's tools.
Check filesystem on older agents. An agent can be full (whole repo mount) if someone ran agent unjail AGENT with no --path. Put it back in a jail with agent jail AGENT --disable, then add only the prefixes it needs.
Site tools do not need a grant. Every session sees every *.tool.sh and *.mcp.sh in the repo through search_tools, describe_tool, and call_tool, even with filesystem off. agent grant site-bot --site sites/sails records that the agent works on that site (see it with agent grants site-bot), but it does not add filesystem tools.
3. Start the job as the agent
By mail. Any email to the agent's address starts a background goal as that agent. The system prompt gets soul.md, and the task is events/email.received.md with , , `` and the rest filled in. Send it from your normal mail client, or from a folder inbox you own:
mail send --as YOUR_INBOX --to site-bot@inbox.sails.app --subject "Daily blog" --text "Write today's post under sites/sails."
Mail goals start in the agent home (agents/AGENT_ID), even if the jail also lists a site. Tell it where to work in the mail or in events/email.received.md.
By goal, with an exact scope. Switch to the agent first, so the goal runs as it and stays inside its jail:
cd ~
su site-bot
goal --background --path sites/sails --time-budget 30m "Write today's blog post under pages/blog/. Small diff. Do not rewrite the brand."
su -
su needs write access or higher. su - brings you back to your own identity. --path defaults to the current directory, so cd ~ first when you pass a repo-relative path. For a long prompt, pipe it on stdin: goal --background --path sites/sails --time-budget 30m < prompt.md.
Expected: JSON with goal_id and a non-terminal status. Then:
goal status GOAL_ID
goal log GOAL_ID
goal wait GOAL_ID --timeout 10m
goal list --path sites/sails
goal status JSON has status, tokens_used, and, once finished, summary. Terminal statuses are complete, impossible, cancelled, and time_budget. Background goals run on a platform worker, so you can close your session.
There is no token or dollar budget. The only caps are wall clock (--time-budget with one unit: 30s, 5m, 30m, 1h, 1d) and the writable scope (--path). When the agent is jailed, --path must stay inside the jail. See /skills/goal.md and goal help.
On a schedule. Agents may run at, cron, and crontab without owner approval, and the job runs as the identity that made it. So su site-bot, then schedule the job, and it fires as the agent with the agent's jail. See Run something every morning.
4. Optional: a readable address
agent claim sitebot --as site-bot
# address: {org}-sitebot@inbox.sails.app
If your org owns the mail domain, the address is sitebot@inbox.sails.app instead. {id}@inbox.sails.app always works, and agent unclaim --as site-bot drops the claim. A claim cannot be a UUID or a reserved word (support is rejected). Passing {org}-sitebot is the same as sitebot. Claims are unique across agents and folder inboxes in the org.
5. Optional: let it publish
Agents are write members. A jailed agent may ship create or ship update a non-root path that is inside its jail and that it can write. Custom --hostname and ship verify stay owner-only. See Publish a site.
Commands
agent help
goal help
| Command | Who | What it does |
|---|---|---|
agent create NAME | owner | Scaffold identity; filesystem disabled |
agent list / agent show ID|NAME | member | Addresses and paths; show adds jail, grants, filesystem |
agent soul AGENT | member | Print soul.md |
agent soul AGENT --stdin / --file PATH | owner | Replace soul.md (owner-owned) |
agent jail AGENT | owner | List jail (filesystem, jailed, paths) |
agent jail AGENT --path PATH | owner | Add a prefix; turns FS tools on |
agent jail AGENT --disable | owner | Remove all disk access (create default) |
agent unjail AGENT --path PATH | owner | Remove one prefix; none left means disabled |
agent unjail AGENT | owner | Whole repo mount (full). Avoid unless you mean it |
agent grant / ungrant AGENT --site SITE | owner | Record or remove a site grant; no FS tools |
agent grants [AGENT] | owner, or the agent for itself | List site grants |
agent claim USERNAME [--as ID] | owner or su'd agent | Readable address |
agent unclaim [--as ID] | owner or agent | Drop claim; UUID address stays |
agent rm ID | owner | Delete agent, its claim, grants, jail, and agents/{id}/ |
su AGENT / su - | write+ member | Switch identity; - returns to you |
goal [--background] [--path P] [--time-budget D] PROMPT | current identity | Start work (prompt from stdin if omitted) |
goal status GOAL_ID [--path P] / goal log GOAL_ID | member | Inspect |
goal wait GOAL_ID [--timeout D] | member | Block until done |
goal list [--path PATH] | member | List goals |
goal elevate approve|deny RUN_ID | owner | Slack approval backup for elevation |
Owners may mail send --as site-bot without su. In a goal already running as the agent, prefer the mail_send and message_send tools.
Layout (do not publish agents/ as a site root):
~/agents/{id}/
soul.md owner-owned
events/email.received.md owner-owned
events/message.received.md
events/slack.received.md
mail/inbox/ mail/sent/ agent-owned
messages/inbox/
slack/inbox/ slack/files/
Inbox stubs are not the thread. Call thread show THREAD_ID before you reply. See Mail from an agent.
Failure modes
| What you see | What it means | What to do |
|---|---|---|
agent create denied | Owner-only | An owner runs it, or elevate that Slack goal |
agent not found: NAME | Typo, or the agent was removed | agent list and use the id |
No bash_exec / write_file on the agent | Filesystem still disabled | agent jail AGENT --path ... |
| Agent edited files outside its jail | You started the goal from your own session, so it ran as you | su AGENT before goal, or mail the agent |
Goal cannot see sites/sails | Mail goals start in the agent home, or --path was omitted | su AGENT, cd ~, goal --path sites/sails ... |
| Goal edited the wrong folder | --path is resolved from the current directory | cd ~ before a repo-relative --path |
agent grant --site but still no file tools | Grant adds no FS tools | agent jail |
goal: dollar budgets are not used; omit --budget / --token-budget | Those flags do not exist | Drop them. Use --time-budget 30m |
goal: invalid --time-budget value: 2h30m | One unit only | Use 150m or 3h |
goal: invalid goal id | Not a goal UUID | Copy goal_id from the start JSON or goal list |
Goal status time_budget | Wall clock hit | Raise --time-budget, or split the job |
agent claim rejected | UUID or reserved word, or name taken | Pick another username |
Goal --path outside the jail | Path must stay inside jailed prefixes | Jail that folder, or pick a path already listed |
agent show says "filesystem": "full" | Someone ran agent unjail with no --path | agent jail AGENT --disable, then add prefixes |
Agent rewrote soul.md | Wrong owner on the file | agent soul AGENT --stdin or --file as the owner |
Same-repo DMs are message send --to OTHER_AGENT, not mail. Slack is a separate bind: Talk to an agent in Slack.