Operation and binding reference
This page specifies the public declaration vocabulary and the currently enforced runtime slice. The capability guide remains the detailed canonical source for value-transfer and structural-validation details; this reference maps the common public contract and links to that implementation-focused document.
Version 0.15.0 output annotation completion
Section titled “Version 0.15.0 output annotation completion”Version 0.15.0 permits Operation(fn, bind=...) to omit output= when the callable has a resolved, non-empty return annotation. Registration snapshots the full annotation, including Annotated metadata, without mutating the original declaration. Explicit outputs remain authoritative; input bindings are never inferred. Published v0.14.0 requires explicit outputs.
Unreleased source: one producer-backed choice in required DAGs
Section titled “Unreleased source: one producer-backed choice in required DAGs”This current-source extension is unreleased and is not part of published summonpot 0.15.0. It admits exactly one producer-backed AgentChoice argument across an otherwise eligible required Exactly(1) acyclic DAG. The endpoint needs Pydantic request/response models, at least one FromRequest, one unique sink reached by every operation, and exactly one sink operation declaring the endpoint’s exact full response annotation. The choice’s exact declared Operation producer returns list[ConcreteModel]; other arguments use supported existing sources or immutable defaults. The agent chooses that argument only, not which branch runs. Historical version 0.15.0 branch/join remains zero-choice, and existing uniquely ordered linear chains retain their multiple-choice boundary.
Summonpot executes every required operation sequentially, choosing the ready operation with earliest declaration priority in this acyclic graph with a unique sink. The producer must precede its consumer by dependency. There is no global choice barrier: independent work earlier in the stable order may already have effects when an empty, unavailable or oversized domain returns the existing redacted 409 before consumer/model work. after expresses business ordering. A singleton binds its exact canonical member with no model lookup/call. Ambiguous choices send only bounded inert candidate evidence and opaque tokens for the current candidate projection to a private selector with no business-function tools. The shared invocation kernel validates the selected member and starts the consumer; no extra result/context disclosure or final model acknowledgment is added. The sink’s audited canonical result is returned.
Explicit function-tool quota (UsageLimits.tool_calls_limit) and private allow_direct=False reject this new shape before effects; they do not route it through model scheduling. This is not a public graph API, parallel scheduler, repetition, feedback, durable recovery or general graph compiler. Milestones 3 and 4 remain partial. See the focused contract and example 23.
Version 0.15.0 bounded repeated calls
Section titled “Version 0.15.0 bounded repeated calls”One required typed operation may run a finite positive number of times (1 <= minimum <= maximum, maximum > 1) with a Pydantic request, at least one FromRequest, direct closed Literal[str] AgentChoice inputs, supported request/context bindings or immutable defaults, and exact full operation-output/endpoint-response annotation identity. Summonpot owns sequential decisions; business functions are not selector tools. It locally validates selections, shares one usage budget and deadline, resolves the model lazily, auto-finishes at maximum, and returns only the final successful canonical result; any failure aborts. Previous-result evidence is limited to 65,536 characters per decision, not an aggregate prompt budget. Explicit tool_calls_limit fails before provider/effects. No producer choices, FromResult, after, zero-minimum/unbounded bounds, implicit batch, or general graph. Existing Exactly(1) and producer-choice routes remain unchanged. Published v0.14.0 is untouched; milestone 3 remains partial and a narrow repeated-stage consumer is now documented below. Broader repeated-result addressing remains planned.
Version 0.15.0 repeated-stage final-result consumer
Section titled “Version 0.15.0 repeated-stage final-result consumer”The original two-operation form lets one bounded repeated producer feed one required, choice-free terminal operation after the producer stage closes. The terminal uses FromResult(producer, field, invocation="final") to bind the final successful canonical result from one immutable closure record; meeting the minimum alone does not make it ready, and a failed or uncertain invocation aborts without earlier-result fallback. This two-operation shape is version 0.15.0, not published v0.14.0 behavior. It does not add aggregation, repeated consumers, inspect/correct/verify workflows, or general graphs. See the repeated-stage contract.
Version 0.15.0 single-stage sequential chains
Section titled “Version 0.15.0 single-stage sequential chains”Version 0.15.0 supports a uniquely ordered chain with one nonterminal bounded repeated operation, an optional resolved prefix and a nonempty resolved suffix. Every other operation is required Exactly(1) with no agent choices. A Pydantic request needs at least one FromRequest across the whole chain, not necessarily on the repeated operation; supported request/result/authenticated-context bindings and immutable defaults remain required. The repeated operation has positive finite bounds (minimum >= 1, maximum > 1), direct closed plain-string Literal choices and a Pydantic intermediate distinct from the response. Ordinary FromResult reads single-invocation results; repeated results require invocation="final", with at least one suffix consumer. Exactly one terminal operation owns the endpoint’s exact full response annotation. Prefix operations run before one lazy model resolution; suffix operations run after immutable stage closure without further model decisions or acknowledgment. One principal, ledger, absolute deadline and usage budget span the request. Prefix results/context/ledger are not implicitly projected into model prompts; receiving constraints are checked before each start. Explicit function-tool quotas reject before all work. No feedback cycles, external choices, multiple repeated stages, aggregation, parallelism or durable recovery are added. Published behavior before v0.15.0 remains unchanged. See the single-stage chain contract.
Version 0.15.0 prefix selection before repetition
Section titled “Version 0.15.0 prefix selection before repetition”Version 0.15.0 also composes exactly one producer-backed choice argument on one required Exactly(1) prefix consumer with one nonterminal bounded repeated stage and a resolved suffix. The candidate producer is an earlier single-start operation returning list[ConcreteModel]; repeated choices remain direct closed string Literal values, and all other operations remain resolved required Exactly(1). Pydantic request/response, chain-wide FromRequest, unique ordering, final-invocation addressing and exact terminal response ownership remain required. Empty/unavailable/oversized candidate domains stop before selection or repeated work; a singleton binds locally, while ambiguity uses canonical request-local tokens. Singleton selection still leads to model-backed repeated decisions. One lazy model-configuration lookup, run, principal, ledger, deadline and usage budget span both phases. No business-function tools, reselection after same-run failure, effect replay or final model acknowledgment are added. A fresh request starts a fresh run. Published behavior before v0.15.0 remains unchanged. See the composed selection/stage contract.
See the canonical contract.
Version 0.15.0 framework-owned progression
Section titled “Version 0.15.0 framework-owned progression”Published v0.14.0 supports exactly one producer-backed choice in an otherwise eligible uniquely ordered required Exactly(1) chain. Included from version 0.15.0 extends that optimization to one or more producer-backed choice bindings. The chain still requires a Pydantic request with at least one FromRequest, at least two required operations, supported request/result/authenticated-context bindings or immutable defaults, and exact full terminal response annotation identity. The producers must precede their consumers and return supported list[ConcreteModel] values.
At each ready consumer, every domain is checked before selection or operation start. Singleton candidates bind locally. Only ambiguous slots are sent to a private decision selector as opaque tokens and bounded inert evidence; it receives no business-function tools, principal or ledger. The selector returns a strict token mapping only, locally checked for membership and receiving-parameter constraints before the shared invocation kernel starts the consumer. Progression continues across subsequent frontiers; the canonical validated terminal result is returned without model-authored completion. One request-local state, effective usage budget, absolute deadline and model resolution (lazy, once at first ambiguity) span all decisions and corrections. Limits of 128 candidates and 65,536 evidence characters are per binding. Explicit tool_calls_limit and allow_direct=False preserve the supported legacy route. Prefix effects are not rolled back; there is no durable resume, effect replay, repeated-call support or general graph/public selector API. This is a partial milestone 3 slice, not milestone completion. See the full contract and roadmap.
Version 0.15.0 branch/join execution
Section titled “Version 0.15.0 branch/join execution”Version 0.15.0 supports a narrow, fully resolved required Exactly(1) acyclic graph with a Pydantic request/response, at least one FromRequest, supported request/result/authenticated-context/default inputs, a unique sink reached by every operation, and exactly one producer of the endpoint’s exact full response annotation. AgentChoice is excluded. Ready operations execute sequentially with declaration-order tie-breaking; after adds business ordering. This is not a public graph API, parallel scheduler, feedback, or general graph support. Existing chain, choice, repetition, and checkpoint behavior is unchanged. Published v0.14.0 is unchanged; milestone 4 is partial and milestone 3 remains partial. See example 20 and the contract.
Version 0.15.0 bounded checkpoint progression
Section titled “Version 0.15.0 bounded checkpoint progression”Version 0.15.0 admits one explicit Required(check, calls=Between(1, M), until="accepted") with finite M >= 2. Its marker must name a stored, non-null strict Boolean field in the validated Pydantic output; until=None retains ordinary semantics. The uniquely ordered required region uses bounds 1..M; a nonempty uniquely ordered optional negative continuation uses 0..M-1. Exactly one Required(..., calls=Exactly(1)) terminal returns the exact full endpoint response and reads only final checkpoint fields. Unsupported marked shapes reject at registration. True closes; false continues, while the Mth false closes unresolved without another continuation. Empty choice domains abort with the existing redacted 409, not an unresolved result. Only one frame operation is in flight; continuation admission atomically retires that round’s authority, so closure cannot race it. Invocations use the existing shared kernel. Request, principal, ledger, usage budget and deadline are shared across rounds. No rollback, replay, durable resume or recovery is provided; effects may remain after later failure. Published behavior before v0.15.0 remains unchanged. See the source contract and examples 18–19.
Endpoint declaration
Section titled “Endpoint declaration”Summon(name) creates an application registry. @summon(path, method="POST", model=None) registers a declaration. The decorated function takes the request contract (a Pydantic model for body endpoints) plus declaration-only dependency markers and returns the endpoint output type. Its docstring is the fixed goal. The body is not executed; call the generated HTTP route, not the Python declaration.
The generated FastAPI app exposes request/response schemas and OpenAPI. POST/PUT/PATCH use request bodies; GET/DELETE/HEAD parameters are query parameters. The supported methods are GET, POST, PUT, PATCH, DELETE, and HEAD. A route’s dependency parameters are not client-provided body fields. For example, declare a body route with @summon("/items", method="POST") and a query route with @summon("/items", method="GET"); parameters on that GET declaration are query inputs. Path placeholders such as @summon("/items/{item_id}") must match a declared scalar parameter. The generated API describes these transport fields; they do not create extra capability authority. See HTTP and error reference.
A request model is the body contract; use scalar/list query-compatible parameters for bodyless methods. Dependency-marker parameters such as result=Required(...) are declaration-only and excluded from HTTP input schemas. The complete guide examples use POST JSON and can be exercised against TestClient(build_app(summon)); for a multi-file CLI-launched app and its acceptance tests, see the support-service example, example test suite, and example guide.
Dependency markers and bounds
Section titled “Dependency markers and bounds”| Public call | Meaning | Default bound |
|---|---|---|
Depends(operation) |
Expose an optional operation; success need not call it. | zero or more |
Required(operation) |
Expose an operation; successful output requires its completion. | at least one |
Exactly(n) |
Bound operation starts to exactly n. |
minimum and maximum n |
AtLeast(n) |
Require at least n calls. |
no maximum |
AtMost(n) |
Permit up to n calls. |
minimum zero |
Between(minimum, maximum) |
Bound calls to the inclusive interval. | given interval |
Required(op, calls=AtMost(3)) means at least one and at most three, because Required retains its lower bound. Depends(op, calls=Exactly(1)) is contradictory and rejected; use Required. Bounds must be nonnegative built-in integers (a bool is not accepted as an integer count); an upper bound below a lower bound is rejected. For the no-model path specifically, the only admitted marker is one required Exactly(1) operation.
Bare callable Depends(fn) and Required(fn) preserve the legacy agent-backed path. A bare callable does not provide the typed argument-source and operation-output contract of Operation.
Typed operation declaration
Section titled “Typed operation declaration”operation = Operation( callable, bind={"argument": FromRequest("field")}, output=ResultModel,)This is signature notation rather than a runnable fragment: callable and ResultModel are placeholders. Use the complete programs in the two Build guides to copy an executable endpoint.
- The first argument is the exact application callable.
bindmaps callable parameter names to explicit sources. Missing, extra, incompatible, or unsupported explicit sources fail during endpoint registration.outputdeclares the operation result schema. In the bound runtime it is locally validated before successful completion; a validation error is not retried automatically.- The sequential chain introduced in 0.11.0 is two or more required
Exactly(1)operations linked A→B byFromResultorafter, usingFromRequest/FromResult, immutable defaults, and optionally producer-backedAgentChoice(from_result=...)fromlist[ConcreteModel]. It has no context in the historical 0.11.0 behavior or broader bounds. Its v0.11.0 execution is agent-mediated; from 0.12.0 the eligible fully resolved slice runs model-free as described below. The unique terminal output annotation must exactly match the endpoint response annotation; the validated canonical terminal result is returned.FromResultestablishes readiness; optionalafteradds success-ordering. Canonical result objects stay hidden; tool results are completion acknowledgments, while choice arguments disclose bounded inert candidate evidence. Unsupported graphs fail closed. This behavior is included from 0.11.0; historical v0.10.0 does not include it. Fully resolved uniquely ordered chains with a Pydantic request, at least oneFromRequestbinding, onlyFromRequest/FromResultor supported immutable defaults, and the terminal operation’s exact full endpoint response annotation execute model-free from version 0.12.0. AnAgentChoicenormally keeps the chain agent-mediated; the result-dependent source exception included from version 0.14.0 is described below. Published v0.11.0 chains remain agent-mediated. - An
Operationobject is immutable at the declaration boundary: binding mappings are snapshotted andafteris tuple-normalized.
Binding sources
Section titled “Binding sources”| Source | Value authority | Current meaning |
|---|---|---|
FromRequest("field") |
Validated request | Canonical request value injected by framework; hidden from agent argument schema. |
AgentChoice() |
Agent/model | The specific argument remains model supplied in the supported agent-backed bound-operation slice. |
FromResult(operation, "field") |
Validated producer result | Supported for the uniquely ordered sequential chain; result-dependent choice behavior is included from version 0.14.0 and narrowly documented below. |
FromContext("key") |
Authenticated application context | Included from version 0.13.0 in the narrow slice described below. |
FromRequest values are checked against the receiving callable parameter noncoercively before application code begins. This is data validation, not authentication or authorization. For supported bounds and receiver schema edge cases, consult the detailed capability contract.
Explicit shapes accepted today
Section titled “Explicit shapes accepted today”From 0.12.0, fully resolved uniquely ordered chains of required Exactly(1) operations with a Pydantic request, at least one FromRequest binding, only FromRequest/FromResult bindings or supported immutable defaults, and the exact full terminal response annotation run model-free. An AgentChoice normally keeps the chain agent-mediated; the result-dependent source exception included from version 0.14.0 is documented in Result-dependent source choice. Historical published boundaries remain unchanged. The runtime enforces the single-operation contract and, from 0.11.0, sequential result chains with exactly one ready operation at each step. The chain requires two or more required Exactly(1) operations, A→B FromResult or independent after ordering, and FromRequest/FromResult, supported immutable defaults, or producer-backed AgentChoice(from_result=...) from list[ConcreteModel]. Authenticated context is supported from version 0.13.0 only in the narrow source slice; broader bounds remain unsupported. An AgentChoice normally keeps execution agent-mediated; see the result-dependent source exception included from version 0.14.0 below. Eligible fully resolved chains run model-free from 0.12.0. Its unique terminal output annotation must exactly match the endpoint response annotation, and its validated canonical result is returned. FromResult establishes readiness; optional after adds success-ordering. Canonical result objects remain hidden; choice arguments disclose bounded inert candidate evidence separately from completion acknowledgments. Unsupported graphs fail registration.
Immutable defaults are exact built-in None, bool, int, float, complex, str, bytes; tuples/frozensets recursively containing only these values are also supported. Mutable defaults, custom types/subclasses, and scalar request declarations do not qualify for direct execution.
| Shape | Current execution |
|---|---|
| Complete sole required operation meeting every direct predicate | Runs the operation directly; no model resolution/construction/call. |
Admitted sole operation or uniquely ordered required Exactly(1) chain with authenticated FromContext (from 0.13.0), a Pydantic request, at least one FromRequest, all remaining inputs resolved through supported bindings/immutable defaults, and exact full terminal response annotation |
Model-free execution after authentication and all context receiving checks, provided no AgentChoice remains. |
| Otherwise admitted context-only or scalar-request declaration | Agent-mediated; authenticated context does not remove the Pydantic request and FromRequest direct-eligibility requirements. |
Complete sole required operation with a direct AgentChoice |
Agent-backed runtime; only declared choice values are model supplied. |
| Bare legacy callable dependency | Existing provider-neutral agent path. |
Unsupported/incomplete explicit Operation contract |
Rejected during registration. |
| Fully resolved sequential chain meeting every 0.12.0 predicate above | Model-free sequential execution; canonical terminal result returned. |
Supported sequential chain with producer-backed AgentChoice |
v0.14.0: exactly one choice uses singleton-local execution or lazy agent handoff. Included from version 0.15.0: framework-owned progression across one or more choices; selectors return only ambiguous tokens, then local execution resumes. An explicit tool_calls_limit retains the one-way agent suffix. Historical v0.13.0 remains agent-mediated. |
| Unsupported graph or explicit contract | Rejected during registration. |
No runtime fallback to a model occurs after direct execution begins. One reserved start is not exactly-once completion: failures and side effects are application concerns.
Output and error behavior
Section titled “Output and error behavior”Operation output validation occurs before the call counts as successful for Required. Endpoint output is validated against its declared response model. For legacy and single-operation agent synthesis, these schema/type guarantees do not prove that model prose derives from operation output. The supported chain instead returns the canonical terminal result. Provider calls may fail or exceed usage limits; HTTP maps invalid request/injected values to 422, usage limits to 429, timeout to 504, and upstream provider errors to 429 (provider throttling) or 502. Public error text is intentionally fixed/redacted; normal server logs omit exception details and capability data. Exact error mapping is implemented in server.py.
Security and side effects
Section titled “Security and side effects”Capabilities are real application callables, not simulations. Keep the declared set minimal, validate identity/authorization inside every operation, avoid raw database connections/sessions, shells, arbitrary SQL, and broad service objects, and add application-side idempotency/transaction safeguards where side effects need them. SUMMONPOT_MODEL=test is keyless but can invoke capabilities with placeholder arguments: it is not a dry-run sandbox. See Architecture & safety and the agent-backed build guide.
Producer-backed choices in sequential chains
Section titled “Producer-backed choices in sequential chains”Version 0.11.0 supports AgentChoice(from_result=producer) only in the uniquely ready
sequential chain, with a declared producer output of list[ConcreteModel]. Candidate
projection is inert and bounded (128 items and 65,536 JSON characters per binding), respects
field exclusions and aliases, and invokes no application serializers; the
model receives opaque request-local tokens, not canonical objects or full canonical-result
context. Local token membership maps the selected token to the exact canonical validated
member—Python equality is not authority. Empty, unavailable, or oversized sets produce a
fixed redacted 409 before model decision and before downstream work, with no extra model
request. At the historical v0.11.0 and v0.13.0 boundaries, this remains agent-mediated; from version 0.14.0, the eligible singleton route is local while two or more candidates remain agent-mediated. Direct
single-operation AgentChoice remains unchanged.
Result-dependent source choice (included from version 0.14.0)
Section titled “Result-dependent source choice (included from version 0.14.0)”Version 0.14.0 adds a narrowly admitted exception to the historical rule that AgentChoice keeps a chain agent-mediated. This behavior is included from version 0.14.0; historical published 0.13.0 behavior does not include it. The complete eligible chain must contain exactly one AgentChoice(from_result=producer) argument and no other unresolved choice. Its producer declares output=list[ConcreteModel]. All other arguments resolve through supported request/result/authenticated-context bindings or immutable defaults. The existing unique-readiness, Pydantic request, at-least-one-FromRequest, and exact full terminal response annotation requirements remain.
The framework executes the resolved prefix and checks the candidate domain using the existing inert projection, receiving predicates, and 128-candidate/65,536-character limits, even for singleton domains. No candidates, unavailable evidence, or exceeded limits produce the existing redacted HTTP 409 before model resolution or downstream effects. A singleton is bound to the exact canonical validated member locally; the suffix and canonical terminal response complete without resolving or constructing a model.
Two or more candidates trigger lazy model resolution at the choice boundary. Only bounded inert evidence and opaque request-local tokens are exposed; token membership is checked locally. The suffix remains agent-mediated in that same run, retaining authenticated context, request, results, reservations, stable tokens, and absolute deadline. The prefix is never replayed and model history is not fabricated. Prefix effects can precede a provider-configuration failure; there is no rollback guarantee.
Other supported declarations outside this optimization retain their existing path. Direct single-operation AgentChoice, published v0.13.0 behavior, and existing model-free paths are unchanged. Multiple choice points, broader graphs, and repeated calls are not enabled by this optimization.
Version 0.15.0 supports one or more producer-backed choices with framework-owned progression. In an otherwise eligible uniquely ordered required Exactly(1) chain, a Pydantic request, at least one FromRequest, supported request/result/authenticated-context bindings or immutable defaults, and exact full terminal response annotation identity remain required. All current consumer domains are checked before selection or start. Singleton bindings resolve locally; a decision-only selector returns ambiguous tokens with no business-operation tools. The shared kernel validates and invokes the operation, then continues locally until another genuine decision is needed. The canonical terminal result returns without a final model acknowledgment. Request/principal, reservations, token domains, usage budgets and one deadline remain request-local across frontiers and corrections. Explicit tool_calls_limit retains the previous one-way agent suffix; allow_direct=False and other noneligible declarations retain their existing route. Limits remain 128 candidates and 65,536 evidence characters per binding, not an aggregate prompt/context budget. Prefix effects may precede provider-configuration failure; no rollback, effect replay or durable resume is added. Historical v0.14.0 remains exactly-one-choice. See the operation reference for details.
Runnable boundary lessons
Section titled “Runnable boundary lessons”The current-checkout path and HTTP-method example exercises URL-owned values and the body/query/no-body distinctions; its scalar declarations remain model-backed. The callable-default and annotation example demonstrates an application-owned default, receiving rejection before a start, and the exact full response contract on a direct operation. These lessons add no runtime capability or public execution mode; their guides distinguish source-only shorthand from published v0.14.0.
Planned vocabulary
Section titled “Planned vocabulary”FromContext outside the supported slices, primitive or untyped collection choices, direct unbounded choices inside chains, broader call bounds, and graph shapes outside the documented version 0.15.0 branch/join slice remain unsupported. FromResult and after also work in that fully resolved branch/join slice. Producer-backed choices remain restricted to the uniquely ordered sequential chain, except for the unreleased one-choice required-DAG source extension documented above. Eligible fully resolved chains run model-free from 0.12.0; any AgentChoice normally remains agent-mediated; see the result-dependent source exception included from version 0.14.0 above. Started, failed, or uncertain operations are not replayed in the same run, but this is not rollback or exactly-once external effects.
Authenticated application context (included from version 0.13.0)
Section titled “Authenticated application context (included from version 0.13.0)”Version 0.13.0 admits FromContext only for a single required operation with Exactly(1) and an eligible uniquely ordered required Exactly(1) chain. This was not included in version 0.12.0. Register Summon(context=authenticate) with a sync or async one-request-argument function returning a Pydantic principal configured frozen=True, extra="forbid". Fields must be immutable primitive values or typed tuples/frozensets. FromContext("tenant_id") refers to the canonical field name, not its validation alias.
The provider executes anew for each HTTP request inside Runtime.timeout, before operations and model resolution. Authentication denial yields a fixed 401; unexpected provider/invalid principal failures yield fixed redacted 500 responses. Context values are not implicitly added to model inputs. Request JSON is not authority. Raw Runtime.call(..., context=principal) is a trusted application entry point only. This feature does not implement login, credential policy, operation authorization, or tenant-scoped data access; the application must perform all of those.
The framework does not insert the context object or its values into model instructions, request prompts, schemas, or error responses. This is not a guarantee that a value is secret if application code discloses it: operation outputs may intentionally be returned to the model on the existing single-operation agent path, and that disclosure remains the application’s responsibility. FastAPI transport validation occurs before the provider; provider execution is within Runtime.timeout. PermissionError maps to 401 only when raised by the context provider; an operation’s PermissionError is an application failure (500).
Principal admission is a non-transforming structural predicate over the authenticator’s canonical values. Validation hooks, custom initialization/post-init hooks, and transforming model configurations fail registration rather than being replayed to change identity.