﻿---
title: Heed's own model calls
description: How Heed makes its own short model calls through the agent CLIs you are logged in to.
url: https://docs-v3-preview.elastic.dev/agents/model-calls
---

# Heed's own model calls
Some of what Heed does needs a model for a moment: a summary, or a typed answer to a question about a session. Heed
makes those calls itself, headless, through the agent CLIs you already use and are logged in to. There is no API key
to set up: every built-in agent that is installed and logged in takes part, each with a cheap model, and they take
turns, or the one you choose in [Settings › Model calls](https://docs-v3-preview.elastic.dev/configuration/inference) takes them all.

| Agent    | Login check (free)          | Cheap model                                                                   | Structured answers  |
|----------|-----------------------------|-------------------------------------------------------------------------------|---------------------|
| claude   | `claude auth status`        | `haiku`                                                                       | `--json-schema`     |
| codex    | `codex login status`        | the "fast and affordable" one in `codex debug models`                         | `--output-schema`   |
| gemini   | none: a failed call says it | `flash-lite`                                                                  | read from the reply |
| opencode | `opencode providers list`   | the cheapest by `opencode models --verbose`, from a provider with credentials | read from the reply |
| pi       | `pi --list-models`          | a small one by name (haiku, flash-lite, mini, …)                              | read from the reply |
| cursor   | `cursor-agent status`       | a small one by name from `cursor-agent models`                                | read from the reply |

Custom agents take no part: Heed knows how to call each built-in headless, not an arbitrary command.

## Model tiers

A call asks for a **tier**, and each agent's dialect says which model that is. **cheap** is what every call used until now
and is still the default; a feature that wants more reads says so (the session panel's `look_model`, see
[Personas in sessions](https://docs-v3-preview.elastic.dev/personas/in-sessions)).

| Tier       | claude   | codex                                                          | gemini, opencode, pi, cursor    |
|------------|----------|----------------------------------------------------------------|---------------------------------|
| `cheap`    | `haiku`  | the detected "fast and affordable" one                         | detected, as in the table above |
| `standard` | `sonnet` | its own default, at medium reasoning (cheap calls keep it low) | its own default                 |
| `strong`   | `opus`   | its own default                                                | its own default                 |

Where heed knows no model for a tier it passes none, so the agent runs its own default, and the call's `:log` row says
so (`tier: standard: no standard model known for codex, its own default`); a model that was named shows as
`tier: standard: sonnet`. `llm_model` in `[agents.<name>]` replaces the **cheap** model only. The cache keeps a tier's
answers apart: the same call at another tier is a new call.
A tier above `cheap` still runs with tools off. A feature that needs a model to read the code asks for more than a tier:
the session panel's `strong` look runs your default agent headless and read-only in the session's worktree instead, the
way the [goal wizard's plan](https://docs-v3-preview.elastic.dev/goals/first-goal) does, on claude's `opus`.

## What they are for

- **Summaries**: where a piece of work stands, written from its git history, its pull request, Heed's timeline and the
  agent's last message, and a handoff brief for an agent taking work over. Heed's prompts for them are built in; add
  your own with `summary_instructions` in `[pilot]`, per org or per repo, like the
  [other instructions](/autopilot/green-and-merged#extra-instructions).
- **Decisions**: typed questions about a session or a PR (pick one of some options, place it on a scale, or how
  likely something is true), answered with probabilities and a confidence. Each one writes a `decide` row in `:log`
  with what it was about, so what you do next can be compared with it. The confidence is the model's own and
  uncalibrated: Heed never takes an action that cannot be undone on it.

Today they write the [ledger](https://docs-v3-preview.elastic.dev/insights/ledger)'s summaries, and in [Attention](https://docs-v3-preview.elastic.dev/github/attention) a
[catch-up summary](/github/attention#catch-up-summaries) of what is new in a thread since you last looked
(ahead for New, on open for the rest, per `[attention] summaries`), a drafted reply (shown in full before anything is posted) and a suggested weight for items no
[rule](https://docs-v3-preview.elastic.dev/github/attention-rules) matched. With `[llm] enabled = false`, none of that happens and the rest of Heed
works as before.

## How a call runs

- In an empty temporary directory, removed afterwards, with the agent's tools off and its session not saved
  (claude: `--tools "" --no-session-persistence --setting-sources ""`, and a short `--system-prompt` of Heed's own;
  codex: `--ephemeral -s read-only`; pi: `--no-session --no-tools`; cursor: `--mode ask`; gemini: `--approval-mode plan` and a policy file of Heed's that denies every tool; opencode: an `opencode.json` in that directory that denies
  every permission). gemini and opencode get the text on stdin, not on their command line.
- By the agent's executable as Heed found it, the first word of its `command`, without your shell: an alias or a shell
  function of that name does not apply here (in panes it does). When detection does not find it, set
  `[tools] path` or the agent's `command` to where it is.
- With a timeout (`timeout_seconds`), a few at a time (`concurrency`), the calls you asked for before background ones.
- Once: an identical call (the same instructions, input and schema) is answered from a cache while Heed runs.


## Which agent takes a call

With `[llm] agent = "claude"`, that agent takes every call alone, and a call it cannot take fails. Otherwise
(`"auto"`, or not set) the usable agents take turns. An agent is skipped while:
- it is turned off (`[agents.<name>] llm = false`),
- it is rate limited in one of your sessions, until its limit resets when that is known,
- one of its calls failed in the last `backoff_minutes`, or said it hit a limit (until the reset it named),
- it reached its daily cap (`daily_calls`, `daily_dollars`): background calls then wait until tomorrow, while the ones
  you ask for still run,
- it is not installed or not logged in.

Every call writes an `llm` row in the call log (`:log`): which agent took it, the model, the
tokens and cost when known, the prompt and the answer, and why the agents before it were skipped. A call that could not
run at all writes a row saying why, so background work that waits on the cap shows there.

## Settings

Settings › Agents, on each agent's Model calls tab, shows whether it takes part, whether it is installed and logged in, the model it uses
(empty: the cheap one detected), and a **Test** button: one tiny call to that agent alone, with its answer, how long
it took and what it cost. The test shows in `:log` like any other call. Below the agents, **Model calls, every
agent** holds the `[llm]` settings: the switch that turns every model call off (and back on), the timeout, how many run
at once, the back-off after a failure, and the daily caps.
![Settings › Agents: claude's part in model calls, after a test](https://docs-v3-preview.elastic.dev/images/shots/agents/model-calls.png)
![Claude's Model calls card: the switch, its login, the model, and a Test that answered Hello! in 2.9 s](https://docs-v3-preview.elastic.dev/images/shots/agents/model-calls-card.png)
The same in config.toml:
```toml
[llm]
enabled = true         
timeout_seconds = 120
concurrency = 2
backoff_minutes = 10
daily_calls = 100      
daily_dollars = 1.0    

[agents.codex]
llm = false            
[agents.claude]
llm_model = "sonnet"   
```

A cost is known when the agent reports one (claude, opencode, pi) or `[usage.prices]` has a price for the model.