AGENT.md
How Agents Work
User prompt → Model reasons → Tool calls → Results → Model reasons → ... → DoneEnvironment context — working directory, git branch, recent commits, platform info Project docs — AGENTS.md, CLAUDE.md, .codex/instructions.md, or GEMINI.mdfiles discovered in the project tree Workspace skills — reusable instructions from .stencila/skills/loaded on demand Provider-aligned tools — file, shell, web, and editing tools matched to the model's provider
Agent Discovery
claudecodexgemini | ||
~/.config/stencila/agents/ | ||
.stencila/agents/ |
claudeclaude
Session Routing
If the agent's provider is an explicit CLI provider ( claude-cli, codex-cli, gemini-cli), a CLI-backed session is always used. Otherwise an API provider is resolved — from the agent definition, inferred from the model name, or the default configured provider. If API credentials exist for that provider, an API session is created. If no API credentials exist but a corresponding CLI tool is available (e.g. anthropic→ claude-cli), the session falls back to CLI. If no CLI fallback exists (e.g. mistral, deepseek), an error is returned asking the user to set the appropriate API key.
stencila agents resolve <name>
Next Steps
Creating Agents — create and configure your own agents Using Agents — run agents from the CLI and TUI Configuration Reference — full reference for AGENT.mdproperties Tools — the tools available to agents and the guard system that evaluates every tool call