Current section
Files
Jump to
Current section
Files
src/pig@agent@msg.erl
-module(pig@agent@msg).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/pig/agent/msg.gleam").
-export_type([agent_msg/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(
" Agent message type for the sans-IO core.\n"
"\n"
" Messages drive the state machine. They represent both user inputs\n"
" and runtime responses fed back into the core:\n"
"\n"
" - `UserPrompt` — a new prompt to process\n"
" - `ProviderResponded` — the LLM's response (or error)\n"
" - `ToolResults` — tool execution outcomes\n"
).
-type agent_msg() :: {user_prompt, binary()} |
{provider_responded,
{ok, pig_protocol@message:message()} |
{error, pig_protocol@error:ai_error()}} |
{tool_results,
list({pig_protocol@message:tool_call(),
{ok, gleam@json:json()} | {error, pig@tool:tool_error()}})}.