Skip to main content

Crate ag_protocol

Crate ag_protocol 

Source
Expand description

Shared Agentty protocol models, schema helpers, and prompt payloads.

This crate contains the transport-neutral wire contracts used between Agentty frontends, session workflows, and provider adapters. It intentionally avoids depending on the main agentty crate so future frontends can reuse protocol parsing and turn-prompt serialization without pulling in TUI state.

Structs§

AgentResponse
Wire-format protocol payload used for schema-driven provider output.
AgentResponseSummary
Structured session summary block emitted alongside protocol messages.
QuestionItem
One extracted question with predefined answer choices.
TurnPrompt
Structured prompt payload for one agent turn.
TurnPromptAttachment
One local image attachment referenced from a prompt placeholder.

Enums§

AgentResponseParseError
Structured response parsing failure details.
ProtocolRequestProfile
Protocol-owned request family preserved across prompt submission and repair retries.
ProtocolSchemaInstructionMode
Controls whether bootstrap prompt instructions include the full protocol JSON Schema text.
TurnPromptContentPart
Ordered content piece produced when serializing one turn prompt.
TurnPromptTextSource
Source classification for one turn prompt text payload.

Functions§

agent_response_json_schema_json
Returns a pretty-printed JSON Schema string for prompt instruction templating.
agent_response_output_schema
Returns the JSON Schema used for structured assistant output.
agent_response_output_schema_json
Returns a pretty-printed JSON Schema string for prompt instruction templating.
build_protocol_repair_prompt
Builds the protocol repair prompt text for one failed parse attempt.
format_protocol_parse_debug_details
Builds one multi-line debug report for a protocol parsing failure.
normalize_turn_response
Normalizes one parsed turn response according to the request profile.
parse_agent_response_strict
Parses one raw assistant message strictly as protocol payload.
prepend_protocol_instructions
Prepends structured response protocol instructions to a prompt.
prepend_protocol_refresh_reminder
Prepends a compact refresh reminder for providers that already received the full instruction contract in the active context.
render_prompt_text_for_agent
Rewrites user-entered @ lookups into quoted agent-facing path tokens.
split_turn_prompt_content
Splits prompt text into ordered text and attachment parts for transport serialization.