microagents-events
Event types and JSON-RPC serialization for the microagents framework.
Overview
This crate defines the core event types that flow through an agent session: initialization, user prompts, streaming deltas, tool calls, skill loading and assistant responses. Each event can be converted to and from a JSON-RPC 2.0 notification for transport over a wire or between processes.
Event Types
| Event | Method | Description |
|---|---|---|
SessionInitEvent |
session.init |
A new or resumed session starts |
SessionStopEvent |
session.stop |
A session ends with success or error |
UserPromptSubmitEvent |
user.prompt.submit |
The user sends a prompt |
StreamDeltaEvent |
stream.delta |
A chunk of streaming response (text or thinking) |
ToolCallEvent |
tool.call |
The model requests a tool invocation |
ToolResultEvent |
tool.result |
A tool returns its output |
SkillLoadEvent |
skill.load |
A skill is loaded into the session |
AssistantResponseEvent |
assistant.response |
The model produces a complete response |
Usage
use *;
use Utc;
let event = SessionInitEvent ;
let rpc = event.to_jsonrpc;
// rpc.method == "session.init"
// rpc.params["session_id"] == "sess-1"
Round-trip
use Utc;
let rpc = builder
.method
.add_param
.add_param
.add_param
.add_param;
let any = try_from?;
License
MIT