Skip to content
Agent Field Notes
Course contentsExpand a topic to choose a lesson.

SYSTEMATIC LEARNING / FOUR-LEVEL COURSE

Capability and status contracts for fallback models

Examine multi-model adaptation, capability matrices, failure classification, and degradation.

Learning objectives: Switching the model changes the decision maker and cannot reset executed facts, authorizations and budgets. Only when the backup model meets the required capabilities and message semantics of the task can it be an executable downgrade path.

Content checked: 2026-10-03 · Each level has independent explanations, tasks and inspections

Choose a starting point based on your familiarity with this topic. Current level: Design · Explain the trade-offs. After completing the task, continue to the next level. Reading and self-checks alone do not establish mastery.

On this level

Review the prerequisites

Suitable for: Backend developers learning Agent applications.

Capability and status contracts for fallback models
Switching the model changes the decision maker and cannot reset executed facts, authorizations and budgets. Only when the backup model meets the required capabilities and message semantics of the task can it be an executable downgrade path.

How does the mechanism work?

Step-by-step explanation
  1. Should the model be automatically changed after the main model returns a rejection?

    Reasons for switching models must distinguish temporary failures from prohibited behavior.

  2. How to handle the tool call ID when switching?

    Changing the message format must preserve correlations with actual actions.

  3. What should I do if the backup model is also limited?

    When fallback also fails, a global stopping rule is needed.

Design · Explain the trade-offs

Explain design trade-offs · Capability and status contracts for fallback models

Objectives of this level: There are cross-routing budgets, circuit breakers, quality thresholds and explicit degradation status.

Visual guide · Fallback preserves business facts

Fallback preserves business facts

This routing fixture performs no writes. Consider fallback only after preserving business receipts, identity, required capabilities and shared limits. Select the figure to open it at full size.

Capability degradation and unknown-result migration boundaries

Save fallback_extension_probe.py and exercise your actual module with a new business ID, changed tool evidence, missing capability, and reordered capabilities.

from copy import deepcopy
from fallback_lab import REQUEST, STATE, EVENT, RoutingRuntime
from fallback_student import route

req, state, event = deepcopy(REQUEST), deepcopy(STATE), deepcopy(EVENT)
req["business_id"] = state["business_id"] = "order-909"
state["facts"] = [{"kind": "tool_result", "operation_id": "stock-check-9", "data": {"quantity": 4}}]
rt = RoutingRuntime()
result = route(rt, req, state, event, ["tools"])
assert result["status"] == "capability_blocked" and rt.calls == []
rt = RoutingRuntime()
result = route(rt, req, state, event, ["json", "unused", "tools"])
assert result["status"] == "draft_ready" and result["business_id"] == "order-909"
assert result["facts"] == state["facts"]
assert rt.calls == [
    {"action": "wait", "units": 2},
    {"action": "fallback", "business_id": "order-909", "facts": state["facts"]},
]
assert rt.ledger == [] and rt.now == 2
print("changed_identity_and_capability_contract_passed")

Expect changed_identity_and_capability_contract_passed and exit 0; the full unchanged grader still needs 17/17.

python3 fallback_extension_probe.py
python3 fallback_lab.py grade --module fallback_student.py --out fallback-final.json

Create your own fallback_negative.py. Preserve correct result formatting while removing the capability gate or changing the actual fallback call to a new business ID. The same grader must exit 1 with a concrete failing case. Retain source SHA and actual audit; a negative control must exercise bad code rather than insert a false field into a report.

For an interview, submit your source, failing/passing reports, repair diff, negative control, and a one-page migration design. Explain authorized fallback conditions for 429, permanent-request feedback, capability-matrix validation, shared primary/backup budgets, same-ID reconciliation for committed/unknown writes, preservation of associations/sources/permissions, and stopping when backup also fails. Provider tool-call IDs can differ; adapters must preserve original action associations and express them in the target protocol. The fixture business_id is not a provider call_id.

This evidence validates local routing policy and protection of authored facts. It implements no real provider adapter, HTTP rate limiting, network deadline, model-quality evaluation, cross-service atomicity, or production performance. A real project needs capability/context/tool-result mapping tests, execution-time authorization gates, and verified write idempotence/reconciliation contracts. Declared capability does not establish reliable task quality.Bounded backoff and idempotence; Function calling associations; lab source.

code example

Changed inputs and negative controls

Change to order-909 and stock-check-9: missing json prevents calls; sufficient capability must pass the actual same ID/facts. Add a defective-module negative control.

Acceptance task for this level

Run the changed-ID/facts/capability probe with your module, add an ignored-capability or changed-call-ID negative control, and document real-provider migration boundaries.

Acceptance self-checks

Reading this browser’s record…

Hide the answer and check your understanding

Why do declared json/tools capabilities still require real adapter tests and evaluation?

Further explanations and practice

When encountering unfamiliar principles, first read the implementation, continuous questioning and migration cases, and then independently explain the premise and boundaries. Answers and notes are saved to the original account record.

All linked explanations and exercises (1 )

Sources and verification scope

The principles are based on public information; the numbers, cases and tasks are the teaching design of this website. Offline experiments verify the range noted on this page, and the learning effect still needs to be judged through independent tasks and feedback.