Skip to main content

Module agent

Module agent 

Source
Expand description

§Module: Agent

§Responsibility

Provides a ReAct (Thought-Action-Observation) agent loop with pluggable tools. Mirrors the public API of wasm-agent.

§Guarantees

  • Deterministic: the loop terminates after at most max_iterations cycles
  • Non-panicking: all operations return Result
  • Tool handlers support both sync and async Fn closures

§NOT Responsible For

  • Actual LLM inference (callers supply a mock/stub inference fn)
  • WASM compilation or browser execution
  • Streaming partial responses

Structs§

AgentConfig
Configuration for the ReAct agent loop.
Message
A single message in the conversation history.
ReActLoop
The ReAct agent loop.
ReActStep
A single ReAct step: Thought → Action → Observation.
ToolRegistry
Registry of available tools for the agent loop.
ToolSpec
Describes and implements a single callable tool.

Enums§

AgentError
Agent-specific errors, mirrors wasm-agent::AgentError.
Role
Role of a message in a conversation.

Functions§

parse_react_step
Parses a ReAct response string into a ReActStep.

Type Aliases§

AsyncToolFuture
A pinned, boxed future returning a Value. Used for async tool handlers.
AsyncToolHandler
An async tool handler closure.