Skip to main content

Crate ag_contracts

Crate ag_contracts 

Source
Expand description

Transport-independent contracts for session and isolated agent execution. Implementations own provider routing and resource cleanup; hosts own scheduling.

Structs§

ActivityEvent
A bounded display snapshot of one observed provider operation.
ActivityFacts
Structured facts about one operation, each present only when the provider reports it. Text fields are bounded single lines.
AgentDefinitionPrompt
Agent prompt state prepared for one provider turn.
ApiEquivalentCost
What usage billed to a subscription plan would cost at the provider’s API list prices. It is no charge: the plan bills a flat fee.
ContextFill
How full a model’s context window was, measured by the reported input tokens of its requests, cache included.
CostEstimate
Estimated cost of some usage: the charge of metered usage and the API equivalent of plan-billed usage, kept apart so an API equivalent is never summed into a charge. An estimate always holds at least one of them; usage with no price has no estimate. Provider bills stay authoritative.
DiffStat
Lines a file change added and removed.
ExecutionPolicy
Worker-selected harness controls, retained across retries and repairs. Defaults inherit the harness configuration. Adapters must reject explicit controls they cannot enforce rather than silently ignoring them.
LineRange
One-based line range of a file read.
ModelUsage
Tokens and estimated charge of one model within one turn or isolated prompt.
OneShotError
Typed failure returned by OneShotClient submissions.
OneShotRequest
Input payload for one isolated prompt that prefers structured protocol output.
OneShotSubmission
Parsed result returned by one isolated prompt execution.
PricedCost
One priced amount in integer micro-USD, one millionth of a US dollar.
ProviderCallBudget
A shared limit on underlying provider turns across cloned requests.
SessionRef
Opaque reference to an active agent session.
SessionStats
Diff statistics of one session worktree. Token usage is recorded separately as crate::TurnUsage.
StartSessionRequest
Input payload for initiating a new agent session.
TurnContinuation
Continuation state for one provider-agnostic agent turn.
TurnContinuationParts
Owned continuation inputs consumed by a runtime adapter.
TurnRequest
Input payload for one provider-agnostic agent turn.
TurnResult
Normalized result returned when one agent turn completes successfully.
TurnUsage
Usage of every model one turn or isolated prompt used.
UsageCheckpoint
Cumulative usage totals an agent reported for the most recent conversation in folder, which a later run there continues.

Enums§

ActivityFailure
Why an operation failed.
ActivityKind
Category of explicitly observed activity.
ActivityStatus
Lifecycle state for an observed operation.
AgentDefinitionPromptUpdate
Agent change for a provider-managed conversation or retained native history.
AgentError
Typed error returned by AgentChannel operations.
AgentRequestKind
Turn initiation mode for TurnRequest.
ContextCompaction
How a turn handles a session context that outgrows the model’s window.
CostBasis
Where the prices of a PricedCost came from.
HostCacheSharing
Which dependency caches (Cargo, Go, pip, npm) sandboxed harness commands use.
McpPolicy
MCP configuration inheritance at harness startup.
OutputEvent
One change to the model output an agent streams while its turn runs.
OutputKind
What one streamed output item holds.
PermissionMode
Supported permission mode values for agent execution workflows.
PlanLogin
Subscription login that bills usage a flat fee, whose priced figure is therefore only an API equivalent.
ReasoningLevel
Supported reasoning-effort levels for task execution.
ResponseStyle
Preferred amount of detail in user-facing session responses.
SessionDiffState
Known availability of a session worktree diff.
SpeedMode
Response-speed preference applied to one agent session.
ToolPolicy
Provider-native built-in tool names. Filesystem permission modes remain an independent restriction; these settings cannot relax a read-only turn.
TurnEvent
Incremental event emitted during one agent turn.
TurnNotice
Something about how a turn ran that the user should know, reported at most once per occurrence while the turn runs. Hosts show it in the session transcript beside the turn’s answer.
UsagePurpose
Work an invocation’s usage is recorded under, so utility work stays distinguishable from session turns.

Traits§

AgentChannel
Provider-agnostic session channel for executing agent turns.
LiveTranscript
Live transcript projection used when a provider runtime needs replay text.
OneShotClient
Provider-neutral boundary for isolated structured agent prompts.
ProviderCallLedger
Observes every change to one shared provider-call pool, so a host can persist spending across process restarts.

Functions§

is_input_size_error
Reports whether a provider rejected the size of an input or context window.
normalize_instruction_conversation_id
Normalizes one provider-native conversation id for persisted bootstrap reuse tracking.

Type Aliases§

AgentFuture
Boxed async result used by AgentChannel trait methods.