Hands-On Session #2: Building Custom Agents & Rules
Build Custom Agents or customize existing agent behavior with the 3 building blocks of agentic workflows: Context, Tools, Triggers.
In this session, you'll learn how to customize agentic behavior by creating both Rules (which enhance the context provided to your agents) and Agents (which replace or extend default behavior from system instructions, enabling you to test and refine your own agentic behavior).
Understanding Rules vs Agents
Before we dive in, let's understand the key difference:
| Rules | Agents | |
|---|---|---|
| Effect | Additive; enhances existing behavior by providing additional context | Replacement; overrides (or extends) system instructions for full control of agentic behavior |
| Use when | You want to add context or customize behavior | You want full control from scratch |
| Risk level | Low; Agents still have their base capabilities | Higher; you're responsible for a large part of the agentic harness |
Part 1: Create a Rule
What are Rules?
Rules are conditional instructions that get injected into Otto's context. They enhance Otto's behavior without replacing it.
Rules can be configured to only apply in specific situations using:
- globs: Match specific file patterns (e.g.,
*.py,*.sql) - keywords: Match when certain words appear in the conversation
Step 1: Create a code style guide rule
Let's create a rule that applies when working with code files, ensuring consistent code quality across your project.
You can ask Otto to create this file for you by asking:
Create a new rule that applies when working with code files, ensuring consistent code quality across the project.
Or you can create the file manually:
- Right-click on the
otto/rules/folder - Select New file
- Name the file
code-style-guide.md - Paste the following content:
- Save the file with
Cmd+SorCtrl+S
Step 2: Test your rule
- Open Otto chat (
Ctrl+I) - Ask Otto to write new code:
Create sql transform on the sales component by adding: sale_date/hour/day_of_week from timestamp, channel logic (Store/Vendor/Website based on store_id/vendor_id), and calculated totals (price * quantity, with tax)
Notice how Otto now references your style guide when working with code files! You can see all the rules Otto has applied by hovering over the icon above your last prompt.
[Optional] Part 2: Create a Code Reviewer Agent
What are Agents?
Agents replace or extend Otto's default system instructions entirely. For this track, we'll create an agent that systematically reviews code and provides structured, actionable feedback.
Creating a custom agent overrides Otto's system instructions unless you add extends: otto. Your agent won't have Otto's built-in behaviors unless you explicitly include them. This is an excellent opportunity to practice context engineering from scratch! See the Custom Agents reference for more details.
Step 1: Create the agent
Ask Otto to create the agent for you by asking:
Please create a new agent that reviews code and provides structured, actionable feedback.
Or you can create the file manually:
- Right-click on the
otto/agents/folder - Select New file
- Name the file
code_reviewer.md - Paste the following content:
- Save the file with
Cmd+SorCtrl+S
Step 2: Test your agent
- Open Otto chat (
Ctrl+I) - Click on Otto at the bottom of the chat panel
- Select your Code Reviewer agent
- Paste this code for review:
- Notice how the agent provides a structured review with prioritized issues and specific fixes!
Switch back to the default Otto agent before proceeding with the lab. Click on your agent name at the bottom of the chat panel and select Otto to restore the default behavior.
[Optional] Part 3: Automate Weekly Code Reviews
Now that you have a code style guide rule and a code reviewer agent, let's create an automation that runs weekly to review all code changes and send you a comprehensive report.
What are Automations?
Automations in Ascend enable automatic triggering of actions based on defined conditions. They combine triggers (sensors for time-based schedules or events for system events) with actions (like running Otto) to create intelligent workflows.
Step 1: Create the automation
Create the Automation file:
- Right-click on the
automations/folder - Select New file
- Name the file
weekly-code-review.yaml - Paste the following content:
- Save the file with
Cmd+SorCtrl+S
Step 2: Test your automation
Before deploying, let's test the automation manually:
- Open Otto chat (
Ctrl+I) - Make sure you're using the default Otto agent (not the Code Reviewer)
- Ask Otto to execute the automation's prompt:
Please follow the exact instructions in the weekly-code-review automation and generate a weekly code review based on my Workspace activity from the past week. Provide the comprehensive report as specified.
This will show you what the automated review will look like when it runs!
Checkpoint
By the end of this session, you should have:
- Explored the
otto/directory structure - Created a custom Rule
- Created a custom Agent
- Tested both customizations
- Understood the difference between Rules (additive) and Agents (replacement)
- Created an Automation to run your agent on a schedule (you'll deploy this later!)
Ask a bootcamp instructor or reach out in the Ascend Community Slack.
Next steps
Continue to the Agentic Data Operations Labs to build an end-to-end data pipeline!