Skip to main content

Module messages

Module messages 

Source
Expand description

NDJSON protocol message types shared between phi-agent and language SDKs.

This module has zero dependency on agent-base — it is a pure serde contract. SDK authors can use this file as the authoritative reference for the wire format without pulling in the entire Rust crate.

§Protocol overview

  • Transport: stdio, one JSON object per line (NDJSON).
  • Schema rule: new fields may be added at any time (receivers MUST ignore unknown fields). Removing or re-typing a field is a MAJOR version change.

§Message flow

SDK → phi serve         SDK ← phi serve
─────────────────       ─────────────────
register_tool           hello (on connect)
create_session          session_created
run                     event
tool_result             tool_call
list_tools              tools_listed
cancel                  done
                        error

Structs§

RunConfig
ToolMetadata
Stable wire-format representation of a registered tool’s metadata. Mirrors agent_base::ToolMetadata without depending on agent-base so SDK authors can read this file as a pure serde contract.

Enums§

IncomingMessage
OutgoingMessage

Constants§

PROTOCOL_VERSION