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

# Agent Mode, Max Steps, and Max Duration

> How Default and Strict mode differ, and how step and time limits bound a run

`agent_config` controls how far the agent is willing to go to finish a goal, and how much it's
allowed to spend doing it. Three fields, each independent: `mode` picks the behavior, `max_steps`
caps tool-call steps, `max_duration_seconds` caps wall-clock time.

## Default vs Strict Mode

Default mode is built for open-ended work: browsing, search, and recovery. When the agent hits an
unexpected state — a popup, a layout change, a missing element — it explores workarounds before
giving up.

Strict mode is built for precise, repeatable automation: tests and workflows where an unexpected
state should fail the run immediately instead of being worked around. Use it when a workaround
succeeding would actually hide a real problem — for example, a checkout test that should fail
loudly if a confirmation dialog doesn't appear exactly where expected, not quietly click past it.

> [!NOTE]
>
> **Beta:** `mode` is beta — enroll at [agent.tinyfish.ai/beta](https://agent.tinyfish.ai/beta) to
> use it. Set `agent_config.mode` to `"strict"` when creating a run; omit it for the default
> behavior.

## Max Steps

`max_steps` caps how many tool-call steps the agent takes before it stops, independent of `mode`.
Accepts an integer from 1 to 500; runs default to 150 when omitted.

Lower it to fail fast and bound cost on simple goals — a one-field extraction shouldn't need 150
steps, and a low cap catches a goal that's looping instead of letting it run to the default limit.
Raise it for multi-page workflows that legitimately need more steps to finish, such as paginating
through a long result set.

> [!NOTE]
>
> **Beta:** `max_steps` is beta — enroll at [agent.tinyfish.ai/beta](https://agent.tinyfish.ai/beta)
> to use it. A non-beta request that includes it returns `403 FORBIDDEN`; requests that omit it are
> unaffected either way.

## Max Duration

`max_duration_seconds` caps the wall-clock time a run is allowed to take, regardless of how many
steps it has used. There's no limit by default. Unlike `mode` and `max_steps`, this field is
generally available — no beta enrollment needed.

Use it alongside `max_steps` when a workflow could legitimately need many steps but you still want
a hard ceiling on how long you're willing to wait — `max_steps` alone doesn't bound time if each
step is slow.

## Combining All Three

```json theme={null}
{
  "url": "https://example.com",
  "goal": "Check that checkout succeeds with a saved test account",
  "agent_config": {
    "mode": "strict",
    "max_steps": 30,
    "max_duration_seconds": 120
  }
}
```

This run fails fast on any unexpected state (`strict`), stops after at most 30 tool-call steps, and
is killed outright if it's still running after 120 seconds — three independent guardrails, not a
single setting.

## Related

> [card] [Configure Agent Mode and Max Steps](https://docs.tinyfish.ai/agent/how-to/agent-mode-max-steps.md)
>
> Set these from the Playground or the API

> [card] [TinyAgent Reference](https://docs.tinyfish.ai/agent/api/agent)
>
> Full `agent_config` field list and defaults

> [card] [Runs](https://docs.tinyfish.ai/agent/explanation/runs.md)
>
> What a run's lifecycle looks like once it starts


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