Guide

Agents

Build focused agents that do one thing well. The key is clear, specific instructions.

Find it in

Agent Anatomy

Every agent has these components:

Name

URL-friendly slug

code-reviewer

Description

What the agent does

Reviews code for bugs

Instructions

System prompt behavior

You are a code reviewer...

Tools

API or OAuth access

github_list_prs

Writing Instructions

Instructions are the most important part of your agent. They define what the agent does, how it responds, and what it can't do.

Best Practices

Be specific about the task

"You are a code reviewer that checks Python code for bugs, security issues, and style problems"

Define output format

"Respond with bullet points. Keep each point under 2 sentences."

Set clear boundaries

"Only review code. Don't write new code or make changes to the repository."

Be concise

Shorter instructions = lower costs per run

What to Avoid

Vague instructions

"Be helpful" — Too vague. What does helpful mean for this task?

Multi-purpose agents

"Handle all GitHub tasks" — Create separate agents for issues, PRs, and reviews.

Redundant context

Don't repeat information already in tool descriptions.

Example Agents

Here are some well-designed agent configurations you can adapt:

GitHub Issue Creator

You create GitHub issues for the acme/main repository.

When asked to create an issue:
1. Extract the title and body from the user's description
2. Add appropriate labels (bug, feature, docs)
3. Use the github_create_issue tool

Keep issue bodies concise. Check for duplicates first with github_list_issues.

Slack Notifier

You send notifications to Slack channels.

Allowed channels: #engineering, #releases, #alerts
Do NOT post to #general or private channels.

When sending a message:
1. Identify the target channel
2. Format with markdown for code
3. Send using slack_send_message

Keep messages brief. Don't @mention unless asked.

Weather Reporter

You report weather using the get_weather API tool.

When asked about weather:
1. Extract the city name from the question
2. Call get_weather with the city
3. Summarize: temperature, conditions, humidity

Keep responses to 2-3 sentences. Use metric units.

Testing Your Agent

Before setting an agent to "active", test thoroughly:

Happy path

Does it handle the normal use case?

Edge cases

What happens with unusual inputs?

Boundaries

Does it respect your constraints?

Error handling

How does it respond when tools fail?

Debug mode

Use moi --debug to see detailed execution traces and tool calls.

Agent Status

Draft

Only you can invoke it. Use for testing.

Active

Can be invoked by anyone with credentials.

Archived

Hidden from lists, history preserved.

Keeping Costs Low

Each agent run is billed based on usage. Keep costs low with efficient agents:

Keep instructions short and focused
Request concise responses
Avoid verbose explanations
Only enable tools the agent actually needs

Next Steps