Skip to main content

Crate ag_agent

Crate ag_agent 

Source
Expand description

Agent backend transports and provider-neutral contracts.

This crate owns the agent execution boundary used by Agentty: provider model metadata, turn prompt payloads, CLI/app-server transports, and channel contracts. It intentionally avoids depending on the agentty application crate so provider-specific dependencies compile in a leaf workspace member.

Structs§

AgentCliInfo
One locally runnable agent CLI and the installed version refreshed at startup.
AgentSelection
Session-level agent selection that keeps provider kind and model together.
AppServerTurnRequest
Input payload for one app-server turn execution.
AppServerTurnResponse
Normalized result for one app-server turn.
BuildCommandRequest
Request payload used to build provider transport commands.
OneShotRequest
Input payload for one isolated prompt that prefers structured protocol output.
OneShotSubmission
Parsed result returned by one isolated prompt execution.
RealAgentAvailabilityProbe
Production availability probe backed by PATH executable discovery.
SessionRef
Opaque reference to an active agent session.
SessionStats
Token and diff usage statistics associated with one agent session or isolated prompt.
StartSessionRequest
Input payload for initiating a new agent session.
StaticAgentAvailabilityProbe
Availability probe that returns one caller-provided snapshot.
TurnRequest
Input payload for one provider-agnostic agent turn.
TurnResult
Normalized result returned when one agent turn completes successfully.

Enums§

AgentBackendError
Error type for backend setup and command construction failures.
AgentCliVersion
Automatic update and version probe state for one locally runnable agent CLI.
AgentError
Typed error returned by AgentChannel operations.
AgentKind
Supported agent provider families.
AgentModel
Supported agent model names across all providers.
AgentRequestKind
Turn initiation mode for TurnRequest.
AgentTransport
Transport runtime used to execute turns for one backend.
AppServerError
Typed error returned by app-server infrastructure operations.
AppServerStreamEvent
Incremental event emitted during one app-server turn.
PermissionMode
Supported permission mode values for agent execution workflows.
ReasoningLevel
Supported reasoning-effort levels for task execution.
TurnEvent
Incremental event emitted during one agent turn.

Traits§

AgentAvailabilityProbe
Detects which provider CLIs are locally runnable on the current machine.
AgentBackend
Builds and configures external agent CLI commands.
AgentChannel
Provider-agnostic session channel for executing agent turns.
AgentSelectionMetadata
Human-readable metadata for slash-menu selectable items.
AppServerClient
Persistent app-server session boundary used by session workers.
LiveTranscript
Live transcript projection used when a provider runtime needs replay text.

Functions§

cleanup_session_worktree_artifacts
Removes provider-owned worktree artifacts derived from one session folder.
create_agent_channel
Creates the provider-specific channel for the given agent kind.
create_app_server_client
Returns the app-server client for the selected provider when applicable.
create_backend
Creates the backend implementation for the selected agent provider.
diff_fence
Builds a Markdown code-fence delimiter long enough to safely wrap an arbitrary prompt payload.
executable_name
Returns the CLI executable name used by the provided agent kind.
normalize_instruction_conversation_id
Normalizes one provider-native conversation id for persisted bootstrap reuse tracking.
parse_persisted_session_agent_model
Parses one persisted session agent/model pair without deriving the agent from the model when the saved agent kind is available.
resolve_agent_kind_for_model
Resolves a provider kind that can run model from the available provider list.
resolve_agent_selection_for_model
Resolves an AgentSelection for a model-only setting.
resolve_model_for_available_agent_kinds
Resolves one model against the currently available agent kinds.
resolve_prompt_model_agent_kind
Resolves the agent kind used for prompt-side /model selection.
selectable_models_for_agent_kinds
Returns all selectable models owned by the provided agent kinds in stable settings and slash-menu order.
submit_one_shot
Executes one isolated prompt and returns the parsed response.
submit_one_shot_with_app_server_client
Executes one isolated prompt through the shared app-server transport.
submit_one_shot_with_backend
Executes one isolated prompt using the provided backend.
transport_mode
Returns transport mode for the selected provider.

Type Aliases§

AgentFuture
Boxed async result used by AgentChannel trait methods.
AppServerFuture
Boxed async result used by AppServerClient trait methods.