Skip to content

Migrating from 0.1

Everything that breaks between 0.1 and the next release, what to search for in your project, what to write instead, and how to check. It is for people, and for the coding agents that work on projects that use featherweight: the last section is written for them, and the skill carries the same page.

The rename of the units is specified, and a test checks the names of its tables against the code (the Python, SQL, settings, spans and logs, and the steps for coding agents).

What breaks

# Change You are affected if you...
1 The run store is gone use RunStore, AgentRunner(store=), RunContext.store or the tools store_get and store_set
2 background_agents is background_jobs give an agent background_agents
3 agent_run_id is attempt_id, and the other words read result.agent_run_id, use the run log's methods, rows or table, or implement observers
4 A Database you wrote implemented Database yourself
5 A queue you wrote implemented JobQueue yourself
6 Stricter checks: identity, job names and skills pass one job_id to runs for several identities, declare an identity model with an exclude=True field and no default, name jobs freely, or write a skill's aread
7 Attachments in a chat serve a chat at all (files are now accepted by default), use the Vercel adapter with a client that can send files, send an empty attachment, match the text of an error, or catch ValueError around runner.stream()
8 Settings, logs and spans set MAX_CONCURRENT_AGENT_RUNS, MAX_AGENT_DEPTH or MAX_AGENT_LAUNCHES, pass a timing or lease argument to a runner, worker or queue, import a runner constant, read the logs, or have dashboards or alerts on the spans
9 Typed output: what is now refused use Claude for an agent with typed output: a dict, a recursive model or many optional fields on Opus, Sonnet or Fable, or tools on Haiku (the default Claude model)

If you use none of these, upgrade and run your tests.

The run store is gone

Agents do not share state: information moves through outputs and return values. The in-memory store (one per runner and process) could not be shared by workers anyway.

Gone Instead
RunStore, from featherweight import RunStore Keep state in your own store, or in a dict keyed by the job id when it lives in one process
AgentRunner(db, store=...) Drop the argument
RunContext.store Drop the use
the tools store_get and store_set Drop them from tools, and from prompts that name them
the fakeredis dependency Nothing to do

Search: RunStore, store_get, store_set, store=, .store. Check: your tests pass, and git grep -n "store_get\|store_set\|RunStore" is empty.

background_agents is background_jobs

The field of an agent takes agent classes and Job classes, and an agent class in it runs as a job of its own, so the name says what it holds.

# before
class Researcher(AgentBase):
    background_agents = [WebSearcher, Summariser]


# after
class Researcher(AgentBase):
    background_jobs = [WebSearcher, Summariser]

There is no alias for the old name, and it is not ignored: a class that still declares a field background_agents is refused when it is declared (TypeError, which names background_jobs).

There is no alias. The tool start_background and the events background_started and background_finished keep their names. The agent's hash does not change, so a resume of a job made before the upgrade still reuses its steps. Search: background_agents. Check: git grep -n background_agents is empty.

Runs, attempts and executions

Each word now names one unit (the spec): a run is one call of an agent, with its retries; an attempt is one try within a run; an execution is one start of a job by a worker; a job is a declared pipeline. "Invocation" is retired, and the id that was called agent_run_id was an attempt's, so it is attempt_id. The table:

Python

Before After
result.agent_run_id result.attempt_id (and result.run_id is new: the id of the run)
runtime.context.agent_run_id (in a tool) runtime.context.attempt_id (and run_id)
CURRENT_AGENT_RUN_ID CURRENT_ATTEMPT_ID
db.list_runs(job_id=..., invocation_id=...) db.list_attempts(job_id=..., run_id=...)
db.get_run, create_run, mark_run_running, finish_run db.get_attempt, create_attempt, start_attempt, finish_attempt
db.find_reusable_run(job_id, agent_hash, input_hash, identity_hash) db.find_reusable_attempt(...)
AgentRunRow AttemptRow
RunStart, RunEnd (in featherweight.db, and exported from featherweight) AttemptRecord, AttemptFinish
row.agent_run_id, row.parent_agent_run_id, row.reused_from_agent_run_id, row.invocation_id row.attempt_id, row.parent_attempt_id, row.reused_from_attempt_id, row.run_id
job_row.parent_agent_run_id job_row.parent_attempt_id
the same fields of the observers' records attempt_id, run_id, parent_attempt_id, reused_from_attempt_id
AgentRunFailed RunFailed
RunStatus Status (same members: INIT, RUNNING, SUCCESS, FAILED, CANCELLED)
ReusedRun (observer record) RunReused
AgentRunner(max_background=...) AgentRunner(max_background_jobs=...)

A streamed run (runner.stream): run.run_id is the id of the run, the one that its events carry and that runner.cancel takes, and the row of the run log has its own id, run.attempt_id. It used to be one id. So await db.get_attempt(run.run_id) (the old db.get_run(run.run_id)) now returns None, with no error: look the row up with get_attempt(run.attempt_id), or with list_attempts(run_id=run.run_id) (its run_id column is the run's).

SQL, if you query the run log yourself: the table agent_runs is attempts; the columns agent_run_id, invocation_id, parent_agent_run_id (also in jobs) and reused_from_agent_run_id are attempt_id, run_id, parent_attempt_id and reused_from_attempt_id. The database is migrated for you: see below.

Check: the old names are gone from your code (git grep -n "agent_run_id\|invocation_id\|list_runs\|AgentRunRow" is empty), and your tests pass.

A Database you wrote

  • Your methods are renamed as in the table above (create_attempt, start_attempt, finish_attempt, get_attempt, list_attempts, find_reusable_attempt), and the records and rows too.
  • find_reusable_attempt takes identity_hash (who is asking): a step is reused only when the old attempt's identity_hash equals the new one, and None matches only None. The attempt record has an identity_hash field.
  • Your schema has the table attempts with the renamed columns and a nullable identity_hash column.
  • It has a new abstract method, job_has_other_identity(job_id, identity_hash): whether the job has an attempt whose identity is not the one given (a job is for one identity). A Database that lacks it cannot be built.
  • Run testing.check_database against it, which checks all of this.

A queue you wrote

A message has two new fields, identity (a JSON mapping or None) and identity_kind (the name of the identity's class, or None): carry them unchanged. Your queue stores them with the other fields, and returns them. testing.check_queue checks that it does, and a queue that drops either fails. SqliteQueue(db) takes no lease or max_deliveries any more (they are FTW_QUEUE_LEASE and FTW_QUEUE_MAX_DELIVERIES); testing.MemoryQueue(lease=) keeps its argument.

Stricter checks: identity, job names and skills

These were accepted before, or failed late. Now they are refused where they are made. Each is a change of code or of a data model, not a rename.

What Now You are affected if you... Do
A job is for one identity A run that names a job_id raises ValueError ("a job is for one identity") when the job already has runs for another identity (or for none, and the reverse) pass one job_id to runs for several users Use one job id for each identity
identity_hash covers the class name of the identity Hashes recorded before differ, so a resume of a job that was resumable and in flight reruns its steps once resume jobs across the upgrade Nothing: the steps run again, once
An identity model with a field marked exclude=True and no default TypeError when the runner, the worker or the client is built (a worker rebuilds the identity without that field) have such a field, for a token that stays in the process Give the field a default (None)
A union of identity models with two classes of one name Refused when built (the class name travels in the queue) name two identity classes alike Rename one
JobWorker(identity_type=...) TypeError when built if its runner does not accept that type give a worker and its runner different identity types Use one type
run_many([]) Checks the identity, as a call with inputs does (TypeError if it is missing or of the wrong type) call it with an empty list and no identity Pass the identity
A job name Must match ^[A-Za-z][A-Za-z0-9_.-]*$ in full: a name with a newline at the end is refused (TypeError for a class). A message whose name does not match fails with UnknownJob, and jobs_lookup is not asked build job names from user input Choose the names yourself
jobs_lookup Cancelled after FTW_JOBS_LOOKUP_TIMEOUT (15 s); the job fails with JobLookupError have a lookup that can take longer Make it quicker, or set the variable
get_skill with a resource path Refused when it has .., starts with /, has a backslash or a control character, or is over 256 characters; ./ and // are tidied. Skill.read and aread never see a refused path have a skill that is read with such a path Use plain relative paths
Skill.aread Must return text: None or bytes is a failed read. Cancelled after FTW_SKILL_READ_TIMEOUT (15 s) wrote an aread Return str; keep it quick

Check: your tests pass, and a worker starts (it builds its checks when it starts).

Attachments in a chat

Warning

A chat now accepts files, and sends them to the model's provider, without any change of yours. 0.1 took text only. Every streaming agent now takes up to 10 attachments and 15 MiB of decoded data in a conversation. Files cost tokens, and their contents leave your application for the provider. No error tells you.

What arrives In 0.1 Now
A file part of a user message, through the Vercel adapter, with a data: URL Ignored: the model got the text An attachment: the file goes to the model
The same with another URL, such as https: Ignored The whole request is refused (BadRequest)
Content that is not text in an AG-UI request or a ChatInput, such as an inline image Refused Accepted when the data is inline (a URL is still refused)

Files in the Vercel messages of the assistant are still ignored.

Decide whether your application takes files. If it does: check who may send what, and set max_attachments and max_bytes on the agent (attachments). If it does not:

class Support(StreamingAgent):
    max_attachments = 0  # no files: a conversation that has one is refused

This refuses, it does not ignore: runner.stream() raises AttachmentLimitError (answer it with a 413), also when the file is in an earlier message, so a chat whose history holds one fails on every turn.

To go on ignoring files, as the Vercel adapter did, take them out of the request before you parse it. This also takes out the links that would be refused. A message that had only files is left empty, so decide what your application answers to one:

import json


def without_files(body: bytes) -> dict:
    """The request of `useChat` with no file parts. Then: `vercel.parse_request(without_files(body))`."""
    request = json.loads(body)
    for message in request["messages"]:
        message["parts"] = [part for part in message["parts"] if part.get("type") != "file"]
    return request

The other changes:

What Now You are affected if you... Do
An empty attachment (no bytes) Refused when a ChatInput is built (ValueError, a BadRequest through an adapter). It used to fail at the provider, in the run send one, or have a stored conversation that has one Drop the part before you build the ChatInput
The error for data that is not base64 Names the likely cause: a data: URL, line breaks or spaces, the URL-safe alphabet, missing padding. The form that is taken is stated: what base64.b64encode and btoa give. Nothing that was taken is refused now, except the empty one match the text of the error Match the type (ValueError), not the text
The limit error AttachmentLimitError, a subclass of BadRequest (so still a ValueError), from runner.stream(). A handler for BadRequest now answers it too (a 422); a handler for the subclass can answer 413 catch ValueError around runner.stream(), or let it reach your framework (a 500 before) Add a handler for AttachmentLimitError that answers 413, before the one for BadRequest
BadRequest Defined in featherweight.errors. featherweight.BadRequest, featherweight.adapters.BadRequest and featherweight.adapters.errors.BadRequest are one class import it from the old module Nothing
The messages of an adapter's BadRequest Both adapters word a refusal alike: messages[0].content[0] is image content ..., and a missing mime type reads messages[0].content[0].source.mimeType: Field required; the AG-UI adapter no longer says "Value error," or "body:" match the text Match the type

A file is not carried from one agent to another, or through a queue, on purpose: pass a reference. The limits (max_attachments 10, max_bytes 15 MiB) have not changed.

Typed output: what is now refused

Warning

An agent that used to work may now raise, and a run that used to succeed may now fail. Nothing here is found by a search for an old name, so check it even if nothing else on this page applies to you.

These are limits of Anthropic's API and SDK, and of LangChain. 0.1 let them through; the next release refuses them (provider limits). There is no setting that turns either check off.

1. An output model that Claude cannot fill

Who: an agent on claude-opus-5-5, claude-sonnet-5-5 or claude-fable-5-2 (and a model that you added to a Claude subclass with native_output=True). Not claude-haiku-5-5, Gemini, Gemma or OpenAI, and not a streaming agent.

In the output model, or a model inside it In 0.1 Now
A dict of any kind, also in a list or optional; a model with extra="allow" The run said SUCCESS and the field was empty Refused
A recursive model, such as a tree whose nodes hold nodes Refused by the API, in the run Refused
More than 24 optional fields (a field with a default is optional; open_questions is one) Refused by the API, in the run Refused

If you stored results from such an agent with a dictionary in its output, look at them: the data may never have been there.

When it raises. Not when the class is declared: when the agent is built, as MyAgent(). The runner builds it, so runner.run(MyAgent, ...) raises a Pydantic ValidationError, as for any wrong agent. It does not return a FAILED result, and no attempt is logged. It names the model and the problems:

claude-sonnet-5-5 cannot fill Out: free-form objects (answers): a `dict`, or a model that takes extra fields, would always
come back empty. Use a list of a small model, for example one with `key` and `value`. ...

Check, before you run anything: build every agent once. It calls no model and needs no key. A test does it:

@pytest.mark.parametrize("agent", [Triager, Reporter])  # every agent of your project
def test_the_agent_builds(agent):
    agent()

An agent that is built from data (create_model, jobs_lookup) is checked when it is built, so build one for each kind of definition that you have. If you choose the model at run time, check each model that you can choose.

Do:

  • A dictionary becomes a list of a small model. Change the code that reads it too:
# before
class Out(AgentOutput):
    answers: dict[str, str] = {}


# after
class Entry(BaseModel):
    key: str
    value: str


class Out(AgentOutput):
    answers: list[Entry] = []  # to read it as before: {e.key: e.value for e in output.answers}
  • A recursive model becomes a flat list with ids: each node holds its id and its parent_id.
  • Too many optional fields: make some required (no default), group the fields in fewer models, or split the work over two agents. A required field must be filled even when the model does not know it, so it can be invented.
  • Or choose a model that is not held to these limits. Test it: each provider differs.

A changed output model is a changed agent: its hash differs, so a job that is resumed across the change runs that step again. A result that was kept in the old shape is not valid in the new one.

2. An answer given before the tools' results were seen

Who: an agent with tools (or sub-agents, skills, MCP servers or background jobs) whose output is asked for as a tool call. Of the built-in Claude models that is claude-haiku-5-5, the default of Claude().

The model can give its answer in the same reply in which it calls a tool. In 0.1 the run succeeded, with an answer written before the tool's result was seen: empty, or made up. Now the attempt fails with EarlyAnswerError and is retried, up to max_attempts (3). If every attempt does it, the result is FAILED.

Do:

  • A retry runs the tools again, and by the time the attempt fails they have already run. A tool that sends, writes or pays must be safe to run twice, as for any failed attempt.
  • If you run with max_attempts=1, handle the FAILED result.
  • It depends on what the model does in a run, so no build or search finds it. After the upgrade, look in the run log for attempts whose error_type is EarlyAnswerError.

Settings, logs and spans

Warning

An old variable name is ignored without a word, and the default takes its place. If you lowered a limit, it is loose again: MAX_AGENT_DEPTH=1 now gives the default of 3, MAX_AGENT_LAUNCHES=2 gives 10, and MAX_CONCURRENT_AGENT_RUNS gives 10. Look in every place that sets them: .env files, compose and deployment files, CI, and the settings of your host.

Before After Notes
the environment variable MAX_CONCURRENT_AGENT_RUNS FTW_MAX_CONCURRENT_ATTEMPTS It limits the attempts (the model calls) that run at once. The argument max_concurrent is unchanged.
the environment variables MAX_AGENT_DEPTH, MAX_AGENT_LAUNCHES FTW_MAX_AGENT_DEPTH, FTW_MAX_AGENT_LAUNCHES Every variable of featherweight starts with FTW_. The old names do nothing.
the arguments AgentRunner(observer_timeout=), JobWorker(lease=, heartbeat=, receive_timeout=, cancel_poll=), SqliteQueue(lease=, max_deliveries=) FTW_OBSERVER_TIMEOUT, FTW_JOB_LEASE, FTW_HEARTBEAT, FTW_WORKER_RECEIVE_TIMEOUT, FTW_WORKER_CANCEL_POLL, FTW_QUEUE_LEASE, FTW_QUEUE_MAX_DELIVERIES These tune a deployment and are environment-only; passing the argument is a TypeError. The list.
the span attribute ftw.invocation.id ftw.run.id
the span attribute ftw.run.id ftw.attempt.id ftw.run.id now means something else (a run, not an attempt): change dashboards and alerts that read it before you upgrade the attribute they read.
the span attribute ftw.reused_from_agent_run_id ftw.reused_from_attempt_id
the log lines invocation_started, invocation_finished run_started, run_finished One per run.
the log lines run_created, run_running, run_finished (the run log's rows) attempt_created, attempt_running, attempt_finished One per attempt. Mind the order if you rewrite them by script: run_finished is both a before and an after.
the keys agent_run_id= and invocation_id= in the log lines attempt_id= and run_id=
the key reused_from= in the log lines of a resume reused_from_attempt_id= The three lines of a resume (run_reused, run_reuse_rejected, result_missing) also carry run_id= now.

Also gone from featherweight.runner: ENV_MAX_CONCURRENT, ENV_MAX_DEPTH, ENV_MAX_LAUNCHES, DEFAULT_MAX_CONCURRENT, DEFAULT_MAX_DEPTH, DEFAULT_MAX_LAUNCHES, DEFAULT_MAX_BACKGROUND, max_concurrent_from_env(), max_depth_from_env() and max_launches_from_env(). To read the limits in force, read runner.max_concurrent, runner.max_depth, runner.max_launches and runner.max_background_jobs. Also gone: featherweight.tools.NO_JOB, a message of the removed run store. An import of any of these fails with ImportError.

The span names do not change (invoke_workflow, invoke_agent, chat, execute_tool).

Your database upgrades by itself

SqliteDatabase and PostgresDatabase apply the migrations they have not applied when they connect, in a transaction each, and keep every row:

Migration What it does
2, identity_hash Adds agent_runs.identity_hash. Runs from before it have none.
3, queue_identity Adds the column of the identity to the sqlite queue table.
4, attempts Renames the table and the columns of the run log (the spec).
5, queue_identity_kind Adds the column of the identity's kind to the sqlite queue table. A message that is queued with an identity when it is applied has no kind, and its job fails (InvalidJobIdentity).
6, attempt_constraints Renames the Postgres constraints of attempts (agent_runs_pkey and the others) to attempts_.... Nothing on sqlite.

Take a copy of a database that matters before you connect to it with the new version, as you would for any upgrade. There is no way back: a database that was migrated cannot be opened by 0.1.

What is new

None of this needs a change; it is here so that you know it exists.

  • Who is asking: a typed identity for a run, for tools, in your process and on workers (identity_type, identity=).
  • Jobs that are not declared in code: jobs_lookup on a worker.
  • Reading a skill from somewhere else: Skill.aread.
  • Attachments in a chat: images, documents, audio and video, with limits (max_attachments, max_bytes). This one can need a change: they are on by default (above). A file for an agent or a job is passed as a reference, and not carried.
  • Configuration: one list of FTW_ variables. New: FTW_MAX_BACKGROUND_JOBS and FTW_WORKER_CONCURRENCY (an argument wins over them), FTW_JOBS_LOOKUP_TIMEOUT and FTW_SKILL_READ_TIMEOUT (15 s each; environment only).
  • Approvals: agents propose and your code executes (a pattern, with two recipes and a chapter of the book), and what is not supported on purpose.
  • Recipes and a glossary that says which name to use.

For coding agents

You are changing a project that uses featherweight 0.1 to the next release. Work in this order, and stop to ask the owner where the page says to.

  1. Find the uses. From the project root, run this and read every hit (rg or git grep -n). Search hidden files too (rg --hidden -g "!.git"), where .env and CI files are:
rg -n "RunStore|store_get|store_set|background_agents|agent_run_id|invocation_id|AgentRunRow|AgentRunFailed|RunStatus|ReusedRun|RunStart|RunEnd|max_background=|MAX_AGENT_DEPTH|MAX_AGENT_LAUNCHES|ENV_MAX_|DEFAULT_MAX_|_from_env|NO_JOB|observer_timeout|receive_timeout|cancel_poll|heartbeat=|lease=|max_deliveries|list_runs|get_run|create_run|finish_run|mark_run_running|find_reusable_run|agent_runs|MAX_CONCURRENT_AGENT_RUNS|ftw\.run\.id|ftw\.invocation\.id|reused_from_agent_run_id|\binvocation_(started|finished)\b"
  1. Remove what is gone, by hand: the run store (the first section). It has no replacement; ask the owner where the state should live if the code relied on it across agents.
  2. Rename mechanically, with whole-word matches, in this order (a later row can match what an earlier row wrote):
# Find Replace with Only in
1 parent_agent_run_id parent_attempt_id code and SQL
2 reused_from_agent_run_id reused_from_attempt_id code and SQL
3 agent_run_id attempt_id code, SQL and logs
4 CURRENT_AGENT_RUN_ID CURRENT_ATTEMPT_ID code
5 invocation_id run_id code and SQL
6 AgentRunRow AttemptRow code
7 AgentRunFailed RunFailed code
8 list_runs, get_run, create_run, finish_run, mark_run_running, find_reusable_run list_attempts, get_attempt, create_attempt, finish_attempt, start_attempt, find_reusable_attempt calls on a database object, and a Database you implement
9 agent_runs attempts SQL
10 background_agents background_jobs code, docs and prompts
11 MAX_CONCURRENT_AGENT_RUNS FTW_MAX_CONCURRENT_ATTEMPTS deployment files, .env, docs
11e MAX_AGENT_DEPTH FTW_MAX_AGENT_DEPTH deployment files, .env, docs. Leave a name that already has FTW_
11f MAX_AGENT_LAUNCHES FTW_MAX_AGENT_LAUNCHES the same
11b RunStatus Status code (the import and every use)
11c ReusedRun RunReused code that implements an observer
11d max_background= max_background_jobs= AgentRunner(...) calls
12 ftw.run.id ftw.attempt.id span queries, dashboards, alerts: before row 13
13 ftw.invocation.id ftw.run.id span queries, dashboards, alerts
14 ftw.reused_from_agent_run_id ftw.reused_from_attempt_id span queries
15 the log lines run_created, run_running, run_finished attempt_created, attempt_running, attempt_finished log queries and alerts: before row 16
16 invocation_started, invocation_finished run_started, run_finished log queries and alerts
  1. Move what has no one-word replacement, and tell the owner what you moved:
  2. AgentRunner(observer_timeout=), JobWorker(lease=, heartbeat=, receive_timeout=, cancel_poll=) and SqliteQueue(lease=, max_deliveries=) become variables (settings): put the same values where the deployment sets its environment, and drop the arguments. testing.MemoryQueue(lease=) stays as it is.
  3. An import of a removed name of featherweight.runner, or of NO_JOB (what is gone): read the limit from the runner, or drop the use.
  4. Files (attachments): find every StreamingAgent and every use of the Vercel or AG-UI adapter. No search for an old name finds this. Ask the owner whether each chat should take files, and do what they choose before the upgrade is deployed.
  5. Build every agent, and fix what is refused (typed output). No search finds this: write or run a test that calls TheAgent() for every agent class, and every model it can be given. It calls no model. For each agent on Haiku with tools, check that every tool that acts is safe to run twice, and tell the owner which are not.
  6. Ask the owner about: a chat that looks up the row of a stream by the run_id of its events (get_attempt( or get_run( with a stream's id, which is now None: use the stream's attempt_id, or list_attempts(run_id=...)), a Database or a queue the project implements (change them as the two sections above say, then run the kits), dashboards, alerts and log queries that are not in the repository, and what the stricter checks and the attachments table list: one job_id given to runs for several identities, an identity model with an exclude=True field and no default, job names built from user input, a skill whose aread can return None, how to reshape an output model that is refused (it changes the code that reads the output, and results already stored from a dictionary field may be empty), an except ValueError around runner.stream() (answer AttachmentLimitError with a 413), and a client that matches the text of an error message.
  7. Check. Run the search from step 1 again: outside this page it must return only what you have read and meant to keep, such as MemoryQueue(lease=), a name that already starts with FTW_, or a word of the project's own. Run the project's tests. If the project has a database that matters, test the upgrade on a copy. Then run git diff --stat and read it: every change should be one of the rows above.
  8. Do not rename a variable that happens to be called run_id or attempt_id in the project's own code, and do not touch the OpenTelemetry span names.