Write effective system instructions
The three instruction fields serve distinct purposes — using them well is the single highest-leverage thing you can do for quality:Be specific about role and scope
Vague instructions produce inconsistent results. Give the agent a clear role and list what it should and should not do.Use planning_prompt for multi-step work
For agents that orchestrate complex tasks — generating reports, extracting data across sources, or running multi-step workflows — planning_prompt tells the agent how to think before it acts:
Choose the right mode
The mode controls how much planning and tool use happens for each turn. Pick the lightest mode that meets your needs — heavier modes take longer and cost more.magpie-2.5-flash is deprecated and being withdrawn. Do not use it for new agents. For Ask behavior, use chat_mode: "llm_router"; for retrieval-focused workflows, use magpie-1.1-flash.chat_mode, config.agent_model, in-app labels, and tool availability.
Scope knowledge for predictable behavior
By default an agent can reach all knowledge your organization has access to. This is convenient for exploration but problematic in production: the agent may pull in unrelated content, or expose knowledge that shouldn’t inform the answer. Setcorpus explicitly to lock down what the agent reads.
config.corpus on the request:
Select tools with least privilege
Giving an agent every tool makes it flexible but also increases the risk of side effects (writing data when the agent should only read) and can add latency from unnecessary tool-selection overhead. Start with the minimum tools needed and add more only when required.Use disabled_tools for fine-grained control
disabled_tools is applied after the tools list — useful when you want most of the default set but need to block specific tools:
magpie-1.1-flash (Extended tier) only supports semantic_search. llm-only supports no tools. Specifying unsupported tools for these models will cause the request to be rejected.Use structured outputs for integrations
When Converse is part of a pipeline — a webhook handler, a data-processing job, or a typed API — usetext.format to guarantee the response matches your schema. This works for every mode and agent.
- Keep schemas flat where possible — deeply nested schemas are harder to validate and produce more hallucination surface.
- Mark only the fields you always need as
required. Optional fields reduce failures on partial data. - Use
additionalProperties: falseto prevent the model from adding undocumented keys.
Iterate faster with the generate → claim → create flow
When starting a new agent, useagents.generate to get a first draft of instructions and tool selection from a natural-language description, then refine by hand.
The
claim_token expires after 7 days. The claim step retrieves the template — it does not create an agent. You still need to call agents.create to persist it.agents.update to iterate on instructions without destroying and re-creating the agent:
Cost and latency guidance
Mode choice is the primary lever for both cost and latency: The table below covers the currently recommended models.magpie-2.5-flash is deprecated and being withdrawn, so it is intentionally omitted.
See Converse modes for the authoritative tier table.
Reduce streaming overhead
When streaming, setinclude_steps: false to suppress intermediate tool and reasoning events. This reduces event volume and is the right default for end-user-facing UIs that only need to show the final answer:
Other latency tips
- Narrow
corpus— a tightly scoped corpus means the retrieval step searches less, returning results faster. - Narrow
tools— fewer tools means less overhead for the agent to decide which to call. - Cache
conversation_id— re-using aconversation_idgives the agent conversation history without re-sending it, keeping prompt size bounded over long sessions.
Next steps
- Getting started with Agents — create and configure agents from scratch.
- Getting started with Converse — the endpoint that runs them.
- Converse modes — full mode and model reference.
- Knowledge and corpus — corpus configuration deep-dive.
- Structured outputs — schema design and response parsing.
- Streaming — full SSE event reference.
- Agents API reference — every field and endpoint.