> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nimbleway.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Writing the Task

> Where instructions go (input, skill, goals) and how to write each so the agent gets it right the first time

Think of the agent as a capable analyst who is new to your domain and can only read the public web. It cannot know your business context, guess which "Acme" you mean, or decide a format you did not state. Every ambiguity you leave in becomes a guess in the output.

## Where each instruction goes

A run has three places for instructions. Putting the right thing in the right place is most of the work.

| Field | Lives on | Holds | Example |
| - | - | - | - |
| `input` | The run | This run's question and entity | "Enrich the 8 companies in input\_data" |
| `skill` | The agent | The standing playbook: objective, approach, steps, absence and disambiguation rules | "You are a market-mapping analyst. Search funding news first, then confirm on the company's own site..." |
| `goals` | The agent | 3 to 6 requirements the output can be checked against | "One row per company, deduplicated on domain" |

Keep `input` short. Long run prompts push the agent's budget into reading instructions instead of the web: runs with prompts over about 1,200 characters returned partial output roughly twice as often in a recent month. Move anything that applies to every run into `skill`.

### Skill is a playbook, not a feature list

A skill that reads "expert in B2B data, accurate, thorough, cites sources" gives the agent nothing to do. A skill that says what to achieve, how to approach it, and in what order, does.

**Weak**

```text theme={"system"}
Expert B2B data researcher. Accurate and thorough. Always cite sources.
Handles company data, contacts, funding and technology.
```

**Strong**

```text theme={"system"}
You are a market-mapping analyst building a clean company list for a
sales team.

Approach: search funding news and startup directories to find
candidates, then confirm each one on the company's own website before
including it.

Rules: treat the user's filters as hard constraints and never dilute
them to reach the row target. One row per company, deduplicated on
domain. Record domain as a bare hostname. Use null for any field you
cannot verify on a public page; never guess a funding stage or year.
Do not stop before the row target unless the criteria are exhausted.
```

On one enrichment task, rewriting the skill from a description into a procedure ("read the vendor's lifecycle page first, include every schema property on every row, check optional fields before stopping") raised the share of filled cells from 68% to 99% with no other change.

### Goals are checkable requirements, not caveats

The agent checks each goal against its output before finishing. A goal it cannot check is noise.

| Not a goal | A goal |
| - | - |
| "Be careful with company names" | "Include a company only if its official site confirms the HQ country" |
| "Try to find recent data" | "Every funding round must have an announcement dated 2024 or later" |
| "Don't make things up" | "Set a field to null when no public page states the value" |
| "Cover as much as possible" | "Return up to 40 rows and do not stop before 40 unless the criteria are exhausted" |

Three to six goals. More than that and they start to contradict each other.

## Anatomy of a good input

| Part | What to state | Example |
| - | - | - |
| Objective | The deliverable in one sentence | "Find AI infrastructure startups matching the filters below" |
| Entity | Enough to disambiguate: name plus domain, or name plus HQ | "Qdrant (qdrant.tech, Berlin)" |
| Fields | What you want back, if there is no schema | "headcount band, latest round, CEO name" |
| Scope and window | Geography, segment, dates | "HQ in the EU, UK or Switzerland; rounds announced since January 2024" |
| Sources | Where to look first | "funding news, investor portfolio pages, each company's own site" |
| Absence rule | What to return when the value is not public | "null, never an inferred value" |
| Stop rule | Row cap and when to stop | "up to 40 rows; do not stop early unless the criteria are exhausted" |

## From vague to production-ready

The same task at three quality levels. Only the third reliably returns what was meant.

**Vague**

```text theme={"system"}
List AI startups in Europe.
```

Which "AI"? Which Europe? How many? What fields? The agent picks for you.

**Better**

```text theme={"system"}
Find AI infrastructure startups in Europe that raised a Series A or later.
```

Scope is clearer. Still no time window, row cap, field list or absence rule.

**Production-ready**

```text theme={"system"}
Find AI infrastructure startups (model serving, inference optimization,
vector databases, GPU orchestration, evaluation tooling, training data
platforms) headquartered in the EU, UK or Switzerland that announced a
Series A or later round since January 2024. Search funding news,
startup directories, investor portfolio pages and each company's own
site. Return up to 40 rows, one per company, domain as a bare hostname.
Set a field to null when no public page states it. Do not stop before
40 unless the criteria are exhausted.
```

## Rules that hold across use cases

* **One entity, or one homogeneous set, per run.** Twelve unrelated products in one prompt returned five rows covering two of them, with the run marked completed. Split by entity or by category.
* **Known rows go in `input_data`, never in the prompt.** Pasting a list into `input` wastes budget and loses the per-row `pre_existing` tracking. See [Enrichment](https://docs.nimbleway.com/nimble-sdk/web-search-agents/use-cases/enrichment.md).
* **Say what to do when a value is not public.** Without an absence rule the agent fills cells with prose like "Not stated publicly" or, worse, a plausible guess. "Return null" is the rule; a nullable field in the [schema](https://docs.nimbleway.com/nimble-sdk/web-search-agents/best-practices/output-schema.md) is the mechanism.
* **Give a row cap and a stop rule.** Truncation is silent: a run that found 5 of 40 completes normally. Ask for a number and count what comes back.
* **Avoid "all", "every" and "comprehensive" on the open web.** They set an unreachable bar and the agent stops when its budget runs out, not when the task is done. Scope the ask, or run it per region or category. On a single named site at `x-high`, exhaustive is fine.
* **Name sources in the prompt.** "Search funding news, investor portfolios and company sites" moved one user's row-target adherence from 47% under target to on target.
* **Pass prior results as an exclusion list.** Put them in `input_data` and say "exclude these domains". Do not paste 300 names into the prompt.

## The intern test

Before running, read the task as if handing it to a sharp intern who has never seen your domain:

* Would they know where to look first?
* Would they know when to stop?
* Would they know what to write when a value is missing?
* Would they know the exact output format?

If any answer is no, the agent will guess there too.

## Next Steps

> **[Output Schema](https://docs.nimbleway.com/nimble-sdk/web-search-agents/best-practices/output-schema.md)**
>
> The schema is the contract

> **[Controlling Sources](https://docs.nimbleway.com/nimble-sdk/web-search-agents/best-practices/sources.md)**
>
> Allow, block, prioritize, avoid

> **[Common Mistakes](https://docs.nimbleway.com/nimble-sdk/web-search-agents/best-practices/common-mistakes.md)**
>
> Wrong and right, side by side


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.