> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.rightbrain.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.rightbrain.ai/_mcp/server.

# Agent patterns

> Design patterns for production agents that use Rightbrain primitives, including knowledge agents, approval-gated ops agents, and scheduled reporting agents.

This page shows how an [agent](/docs/concepts/agents) can work with [Tasks](/docs/concepts/tasks), [Skills](/docs/concepts/skills), [Connections](/docs/concepts/connections), and Collection-backed [knowledge](/docs/concepts/collections). Each pattern is a starting point, not a fixed recipe.

Patterns describe how primitives fit into a runtime architecture. [Templates](/docs/templates/growth) are ready-made Task configurations grouped by business area.

## Specialist agent

Give one agent a small, focused toolkit and a clear job. Make only the Tasks, Skills, and Connections it needs available. Because Tasks return schema-validated output, the agent can reason over stable intermediate data rather than parsing free text.

#### Development assistant

A code-aware agent that answers "why is payment processing slow?"

#### Locate the code

The agent calls a **codebase search task** for "payment processing" and identifies the payment service and its queries.

#### Pull performance data

It calls a **metrics task** and sees P95 latency jumped from 200ms to 2000ms three days ago.

#### Check recent changes

A **git history task** surfaces a query change from three days ago.

#### Diagnose

A **query analyser task** finds a missing index causing a full table scan. The agent recommends the index and estimates the improvement.

Each task is a reliable specialist. The agent connects the dots across code, metrics, and history.

#### Content assistant

An agent that turns a brief into a multi-channel content package.

#### Research

The agent calls a **changelog task**, a **customer-feedback task**, and an **SEO keyword task** in parallel, then synthesises structured research notes.

#### Draft

It calls a **long-form content task** per section and assembles a coherent draft.

#### Check quality

A **readability task** and a **brand-compliance task** score the draft; the agent regenerates any section that fails.

#### Adapt

Adaptation tasks produce social, email, and sales-enablement versions.

The same tasks are reusable elsewhere: one definition powers this agent, an automated workflow, and an internal tool alike.

#### Sales-prep agent

An agent that turns 30 minutes of manual research into a meeting brief.

#### Research in parallel

Given a prospect (say, Datadog), the agent runs a **prospect-research task** and an **industry-trends task** at the same time, each backed by a web-search input processor.

#### Anticipate objections

An **objection-handler task** returns likely pushback and responses, its output constrained to a fixed set of categories so the result is always structured.

#### Assemble the brief

A formatter task composes the research into one meeting-prep brief and terminates the run with structured output.

The first run completes in about 43.8 seconds. A follow-up question in the same session reuses the earlier research and returns in 2.7 seconds, because the agent does not re-run the tools it does not need.

#### Vendor evaluator

An agent that scores an external dependency and explains its reasoning.

#### Read the source

The agent reaches a documentation [MCP server](/docs/concepts/connections) and pulls the structure and contents of a target repository.

#### Assess

It evaluates design patterns, dependencies, and security posture, then returns a recommendation grounded in what it read.

#### Answer follow-ups

Later questions ("how does this compare to the alternative?") are answered from memory, with no further tool calls.

Evaluating the Flask web framework this way produced a 9.0/10 "strongly recommend" verdict in 35.3 seconds. Swap the repository to point the same agent at any dependency you are considering.

## Knowledge agent

When an agent needs to answer from your documents, back one of its tasks with a **collection**. Collections attach through a task's RAG configuration, not directly onto the agent: the task retrieves the relevant passages from the collection and the agent reasons over the grounded result.

#### Build the collection

Ingest your knowledge base into a [collection](/docs/concepts/collections) — upload files or connect a datasource.

#### Wire it into a task

Configure a task's RAG to query that collection, so every call retrieves supporting passages before the model answers.

#### Attach the task to the agent

The agent now has a grounded lookup tool. It calls the task when a question needs your documents and cites the retrieved context in its answer.

Use this for support agents that answer from product docs, internal assistants that draw on policy manuals, or research agents that reason over a corpus you control.

The knowledge does not have to be a static collection. When the source is a live workspace, connect it over MCP instead: one briefing agent searched a Notion workspace, fetched 24,200 characters across the matching pages, and synthesized a 5,200-character weekly briefing in 107.8 seconds from a single call, a 4.7x compression, with Rightbrain handling the OAuth token throughout.

## Approval-gated ops agent

When an agent can take real actions — issue a refund, send an email, update a record — gate the risky tools behind human approval. Set a tool's action mode to **require approval**: when the agent calls it, the run pauses with status `waiting_for_human` and raises an approval request. Approval records the decision; the client then resumes the run. Rejection follows the tool's configured behavior. See [Approvals](/docs/production/approvals).

#### Investigate

A customer says an order never arrived. The agent calls a **customer lookup task** and an **order tracking task**, and finds the package was marked delivered.

#### Check policy

A **refund policy task** confirms the order is eligible for a refund.

#### Pause for approval

The agent calls the **refund processing task**, which is gated. The run pauses; a support team reviewer approves the request, then resumes the run.

#### Resolve and log

The refund runs, and a **ticket task** records the full history for audit.

Auto-run the safe, read-only tools; gate only the ones that change state. That keeps the agent fast where it is safe and supervised where it matters.

## Scheduled reporting agent

Not every agent waits for a person. Point a **[schedule trigger](/docs/concepts/triggers-and-runs)** at an agent to run it on a cron cadence — a Monday-morning account review, a nightly anomaly sweep, an end-of-quarter summary.

#### Gather

On schedule, the agent calls a **customer data task**, a **revenue trend task**, and a **support ticket task** for the reporting window.

#### Synthesise

It correlates the results — flagging accounts where declining usage meets negative support sentiment as churn risks, and expanding accounts as upsell candidates.

#### Deliver

A [connection](/docs/concepts/connections) posts the summary to Slack or writes it to a Google Sheet, with no one in the loop.

The formatter constrains the shape of successful output so downstream systems can parse it. Independent lookups may run in parallel in agentic mode, but that is a model-selected optimization rather than a guarantee; express dependencies clearly and measure the run's phase timing.

## Next steps

#### [Agents concept](/docs/concepts/agents)

How agents, revisions, and tool wiring work.

#### [Build your first agent](/docs/quickstart/first-agent)

Make a Task available to an agent and run it end to end.

#### [Approvals (HITL)](/docs/production/approvals)

Gate risky tools behind human review.

#### [Memory & context](/docs/concepts/memory-and-context)

Control long sessions and inspect context pressure.

#### [Evals](/docs/production/evals)

Replay representative runs against candidate revisions.

#### [Run agents via API](/docs/api/run-agents)

Invoke agents over HTTP with streaming output.