Skip to main content
Code-defined skills are Python classes that implement robot behaviors with explicit logic. Three things make them easy to write: The agent reads your code. Your execute() signature and docstring are the API contract — the AI sees execute(target: str, speed: float = 0.5) plus the docstring and knows exactly how to call your skill. Type hints matter.
def execute(self, target: str, speed: float = 0.5):
    """Move toward the target object.

    Args:
        target: Object to approach (e.g., "cup", "person")
        speed: Movement speed in m/s
    """
Dependencies are one-line class attributes. Declare what you need and the system injects it — no wiring in __init__:
class MySkill(Skill):
    mobility = Interface(InterfaceType.MOBILITY)                    # hardware access
    image = RobotState(RobotStateType.LAST_MAIN_CAMERA_IMAGE_B64)   # sensor data
Then just use them. No callbacks, no message passing:
def execute(self):
    if self.image:                    # Latest camera frame, updated at 50Hz
        self.mobility.rotate(0.5)     # Rotate 0.5 radians

The Skill Class

Every code-defined skill extends Skill and implements these methods:
from brain_client.skill_types import Skill, SkillResult

class MySkill(Skill):
    @property
    def name(self):
        return "my_skill"  # Unique identifier

    def guidelines(self):
        """Tell the agent when to use this skill."""
        return "Use when you need to [do something specific]"

    def execute(self, param1: str, param2: float = 1.0):
        """Do the thing. Agent calls this with parsed arguments."""
        # Your logic here
        return "Result message", SkillResult.SUCCESS

    def cancel(self):
        """Stop gracefully when interrupted."""
        return "Cancelled"

Skill Results

Return a tuple of (message, status) from execute():
from brain_client.skill_types import SkillResult

def execute(self):
    if success:
        return "Task completed", SkillResult.SUCCESS
    elif self._cancelled:
        return "Interrupted by user", SkillResult.CANCELLED
    else:
        return "Something went wrong", SkillResult.FAILURE

Feedback

Send progress updates during long-running skills. The agent reads feedback in real-time and can act on it—for example, canceling the skill or triggering another one immediately:
def execute(self):
    for i in range(10):
        self._send_feedback(f"Step {i+1}/10")
        # ... do work ...
    return "Done", SkillResult.SUCCESS

Next Steps