Opidocs
GuidesAgentForce guides

Write effective instructions

Write the instructions that define how your agent behaves.

Intermediate · ~15 min · Prerequisites: admin access to AgentForce

Building and editing agents is admin-only. Members can run and observe agents, but only admins can create or change them.

What you'll do

Open the Instructions section of the builder and write the role statement, rules, and output format that shape every response your agent gives.

Open Instructions

Go to /admin/agents/<slug>/edit and click the Instructions section in the builder sidebar. This is a free-text editor where you define the agent's personality, role, and behavior constraints. The instructions are sent to the model as a system prompt on every conversation turn.

See Instructions for a detailed breakdown of how the system prompt is constructed.

State the role and goal

The first thing in your instructions should be a clear role statement: who this agent is and what it's for. Write in the second person, as if you're addressing the agent directly:

You are a support triage assistant for the Opisense customer support team. Your job is to read incoming support tickets and produce a one-paragraph first response, a suggested priority (Low / Medium / High), and a list of the three most likely root causes.

Keep it to two or three sentences. A focused role statement prevents the agent from drifting into tasks outside its scope.

Give rules and boundaries

After the role, list what the agent must do and what it must avoid. Be explicit — the model follows explicit rules more reliably than it infers them from examples.

Structure this as a short bulleted list:

  • Always ask for the user's account ID before attempting a lookup.
  • Never share internal pricing data. If the user asks, direct them to the sales team.
  • If you can't determine priority with confidence, default to Medium and flag the ticket for human review.
  • Keep responses under 150 words.

Rules and boundaries are where you encode your org's compliance requirements, tone guidelines, and escalation logic. A brief instruction here is far more reliable than hoping the model infers it from context.

Show the format

Tell the agent what good output looks like. The clearest way to do this is an example:

## First response
[One paragraph acknowledging the issue and next steps.]

## Priority
[Low | Medium | High] — [one-sentence rationale]

## Likely root causes
1. [Cause]
2. [Cause]
3. [Cause]

Embedding a template like this dramatically reduces format drift. If your agent needs to produce structured output (JSON, Markdown tables, numbered lists), spell out the schema directly in the instructions.

Save and test as you go

Instructions are a first draft, not a final product. After writing your initial version:

  1. Click Save to commit the draft.
  2. Open the test panel (the button in the top-right of the builder) and run two or three real prompts.
  3. Look for output that misses the format, ignores a rule, or drifts out of role.
  4. Edit the instructions to address each issue and test again.

Three rounds of edit-and-test is usually enough to get a stable baseline before you add tools. See Test before you publish for the full testing workflow.

Short, specific rules outperform long, vague ones. If a rule needs more than two sentences to explain, break it into two rules.

Try this next

On this page