Agent SDK
The Agent SDK lets you customize and extend the RBS coding agent with project-specific capabilities. Define custom tools, system prompts, teammate roles, subagents, and slash commands — all in yourWORKSPACE.rbs or BUILD.rbs files using the RBS DSL.
Overview
| Extension | API | Purpose |
|---|---|---|
| Tools | native.define_agent_tool() | Custom actions the agent can take. |
| Prompts | native.define_agent_prompt() | Specialized system prompts with linked tools. |
| Subagents | native.define_agent_subagent() | One-shot specialist agents for isolated tasks. |
| Teammate roles | native.define_agent_teammate_role() | Reusable roles for multi-agent teams. |
| Skills | native.define_agent_skill() | Slash commands for common workflows. |
Loading built-in tools
Load the built-in agent tools (Git status, Git log, file analysis, etc.) in your workspace:Custom tools
Basic tool with a shell command
Tool with parameters
Tool with implementation function
For complex logic, use an implementation function with fullctx access:
The ctx object for tools
When using implementation, your function receives a ctx object with these modules:
ctx.attr — Access parameters
ctx.file — File operations
ctx.dir — Directory operations
ctx.shell — Execute commands
ctx.path — Path manipulation
ctx.json — JSON operations
ctx.output — Return results
Custom prompts
Create specialized system prompts with linked tools:Custom subagents
Create subagent types for one-shot, isolated specialist tasks:| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Unique subagent name. |
description | string | Yes | What the subagent does. |
when_to_use | string | No | Guidance for when to invoke this subagent. |
system_prompt | string | Yes | System prompt for the subagent. |
tools | string list | No | Tools the subagent can use. |
read_only | bool | No | If True, the subagent cannot modify files. |
Custom teammate roles
Create reusable roles for multi-agent teams:| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Role name (used in spawn_teammate). |
description | string | Yes | What this role specializes in. |
system_prompt | string | Yes | System prompt for teammates with this role. |
tools | string list | No | Tools available to this role. |
capabilities | string list | No | Declared capabilities for role matching. |
Custom skills (slash commands)
Create slash commands for common workflows:| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Skill name (becomes a /command). |
description | string | Yes | What the skill does. |
usage | string | No | Usage example. |
prompt | string | Yes | Prompt template. Use {args} for user input. |
tools | string list | No | Tools the skill can use. |
Long-term memory
The coding agent has a persistent memory system that remembers things across sessions — design patterns, user corrections, file-specific notes, and architectural decisions. Memory is stored as human-editable markdown in.rbs/memory/.
How memory works
Memory file format
Memory files are plain markdown, stored alongside your code:## [m-xxxxxxxx] headers:
Memory tools
| Tool | Description |
|---|---|
memory_save | Save a new memory entry. |
memory_recall | Recall memories for a file or package. |
memory_update | Update an existing entry by ID. |
memory_delete | Delete a stale or incorrect entry. |
memory_search | Search across all memory files. |
memory_list | List all stored memory files. |
Editing memory directly
Memory files are just markdown. You can read, edit, add, and delete entries directly in your editor — the agent respects your changes.Complete example
Attribute types reference
| Type | Description | Example |
|---|---|---|
attr.string() | String value. | "hello" |
attr.int() | Integer value. | 42 |
attr.bool() | Boolean value. | True |
attr.string_list() | List of strings. | ["a", "b"] |
attr.label() | Build target label. | "//pkg:target" |
attr.label_list() | List of labels. | ["//a:x", "//b:y"] |
attr.string_dict() | String dictionary. | {"key": "value"} |
doc(string) — Description shown to the AI model.mandatory(bool) — Whether the parameter is required.default(any) — Default value.
Best practices
- Clear descriptions — Write descriptions that help the AI model understand when to use the tool.
- Document parameters — Use
docfor all attributes. - Handle errors — Always check for errors and return meaningful messages.
- Keep tools focused — Each tool should do one thing well.
- Define roles for your team — Create custom teammate roles matching your project needs.
- Use subagents for isolation — Use read-only subagents for analysis tasks.
- Create skills for workflows — Turn common multi-step workflows into slash commands.