# Agent examples

> Three worked examples with the exact tool calls in order, and a sample prompt for each: a LinkedIn post, a scheduled article and a weekly loop.

Source: https://prefera.si/docs/agents/examples
Docs index for agents: https://prefera.si/llms.txt

Each example lists the tools your agent calls, in order, and a prompt you can paste. Connect your agent first: [Connect an agent (MCP)](/docs/agents). Argument names are exact. The full list is in the [MCP tool reference](/docs/agents/tools).

## Write a LinkedIn post and post it

Prefera writes the post from your approved facts. Your agent posts it from your own account with its computer-use or browser tool. Prefera never posts to LinkedIn itself.

Needs: **Read + write fixes**.

1. `list_brands` to find the brand (skip with one brand).
2. `create_piece` with `kind: "linkedin_post"` and `topic` (3 to 300 characters, in your own words). By default Prefera drafts it in the background and answers at once with `fix_number` and `status: "drafting"`. Call `get_fix` with `fix_number` about a minute later: the draft is ready when `status` is `"draft"`, and `get_fix` returns the `text`. Use `writer: "agent"` to have your agent write it instead. Then Prefera makes no model call and returns an `agent_prompt` and the approved facts.
3. Optional: `save_draft_text` with `fix_number` and `body_md` to edit the text. Every save re-checks each claim.
4. The agent posts the text on LinkedIn with its own computer-use or browser tool and copies the public link of the post.
5. `mark_posted` with `fix_number` and `url`, the public address of the post. Only call it after the post is really live.

A piece made from a `topic` alone is recorded but not measured by Proof, because it targets no question. To build the post from a page or a tracked question instead, pass `source_url`, `source_fix_number` or `question_ids`.

Sample prompt:

```text
Use my Prefera MCP server. Call create_piece with kind "linkedin_post" and the topic
"why we built our pricing page around three questions". It is written in the background: call
get_fix with the fix_number about a minute later, until status is "draft". Show me the text before you post.
When I say go, open LinkedIn in the browser and post it from my profile. Then call mark_posted
with the fix_number and the link of the post. Never post anything I have not approved.
```

## Write and publish an article on a schedule

Needs: **Read, write and publish**, a connected site (see [Connect your site (CMS)](/docs/integrations/cms)) and an owner or editor. Scheduling is a publish action, so with **Ask me in Prefera first** on it waits in **Approvals**.

1. `create_piece` with `kind: "new_page"` and `topic`. Prefera drafts the article from your approved facts in the background (a long article with images takes a minute or two) and answers at once with `fix_number` and `status: "drafting"`. Call `get_fix` with `fix_number` about a minute later, again until `status` is `"draft"`. Use `question_ids` instead of `topic` to aim it at questions you are losing, so Proof can measure it.
2. `flagged_claims` with `fix_number` lists the sentences no approved fact supports. A draft with none left is ready to publish.
3. For each flagged sentence, call `remove_flagged_claim` or `accept_flagged_claim` with its `start`, `end` and `text`. Or change the text with `save_draft_text`. Only keep a sentence on purpose if you have checked it. To have Prefera write the whole article again, call `regenerate_draft`. It is also written in the background: it answers at once with `status: "drafting"` and `previous_version`. Call `get_fix` about a minute later, until `status` is no longer `"drafting"`. If `get_fix` shows `redraft_error`, the fresh draft was not written and the previous text is unchanged. `restore_draft_version` brings back an earlier version.
4. Optional: `publish_preview` shows the article as your site will show it.
5. `get_fix` lists the `destinations` (ids of your connected sites). With more than one, `set_fix_destination` or `set_fix_destinations` picks them.
6. `schedule_fix_publish` with `fix_number` and `schedule`, a list of `{ destination_id, publish_at }`. `publish_at` is an ISO 8601 time with a zone, in the future, such as `2026-12-01T09:00:00Z`.

`cancel_fix_schedule` cancels it. To publish at once, use `publish_fix_live`. At the scheduled time Prefera runs the same checks as `publish_fix_live`, as the person who owns the connection, and only if they may still publish then.

New pages follow the publishing pace guard. If `create_piece` answers `pace`, wait for `next_slot`.

Sample prompt:

```text
Use my Prefera MCP server. Create an article with create_piece (kind "new_page") on the topic
"how to pick an invoicing tool for a small agency". Wait for the draft: call get_fix with the
fix_number every minute until status is "draft". Then check flagged_claims. Remove any sentence
that no approved fact supports, then show me the final text. If I approve it, call get_fix to
find my site's destination id and schedule it with schedule_fix_publish for next Tuesday
at 09:00 UTC. Stop and tell me if any tool answers with an error code.
```

## Run the weekly autopilot loop

Your agent finds this week's work, writes each fix with its own model and records what went live. Prefera only plans and measures. Needs: **Read + write fixes**.

1. `autopilot_plan` with `max` (up to 10; default 3). It returns this week's items within your plan's limits and a `weekly_prompt`. Add `include_offsite: true` to plan outreach, replies and review requests too. If there are no items it says why.
2. For each item, `start_fix` with the item's `move_id` and `writer: "agent"`. This creates the fix without spending Prefera model tokens and returns an `agent_prompt` with the approved facts it may use.
3. The agent follows `agent_prompt` in your repository, builds, and opens a pull request or deploys the way you normally do.
4. Once the change is live, `mark_fix_published` with `fix_number` and the live `url`. Prefera then re-checks the questions.
5. At the end, `get_results` for what the published fixes did.

The agent never sends or posts off-site items for you. It writes the text and you send it.

Sample prompt, shortened. The full weekly prompt is on **API & MCP** under **Autopilot from your agent**, and `autopilot_plan` returns it as `weekly_prompt`:

```text
Every Monday, use my Prefera MCP server to run my weekly routine.
1. Call autopilot_plan (max 3). If it returns no items, say "Nothing to do this week" and stop.
2. For each item call start_fix with its move_id and writer "agent".
3. Follow agent_prompt exactly: use only the approved facts, never invent numbers or quotes.
4. Open a pull request. Do not deploy to production unless I allow it. When it is live,
   call mark_fix_published with the fix_number and the live url.
5. Never send or post anything for me.
6. If a tool returns rate_limited, limit, pace, resting or forbidden, skip that item and tell me.
7. At the end call get_results and write me a short report.
```

Schedule it as a weekly task in your agent. Pages in their 90-day rest are refused. See [Permissions, approvals and limits](/docs/agents/permissions) for the codes.
