API Reference agentsea_core v#0.1.0

Copy Markdown

Modules

An agent is a GenServer that owns its conversation state and runs the agentic loop: call the provider → if it requests tools, run them concurrently and feed the results back → repeat until the model answers or max_iterations is hit.

Static configuration for an AgentSea.Agent.

An agent's bid on a task, produced by AgentSea.Agent.bid/2. Used by the auction delegation strategy. estimated_cost combines the model's price tier with the estimated effort, so the :cheapest criterion can distinguish a cheap-but-slower model from an expensive-but-faster one.

A named capability an agent has, with a proficiency level. Capability matching is pure: given an agent's capabilities and the names a task requires, compute which are matched/missing, an aggregate score in [0, 1], and whether the agent can execute the task at all.

Conversation memory. Adapters (buffer, summary, vector) implement this behaviour. search/2 is optional (only vector-backed stores implement it).

A simple in-memory conversation buffer backed by a GenServer.

Conversation memory that keeps the most recent messages verbatim and compacts everything older into an LLM-generated summary once a conversation grows past a threshold — bounding context size on long chats.

Static capabilities of a model, used by the gateway and for validation.

Coarse relative price tiers for models (not exact pricing) — enough for the auction's :cheapest bid and the gateway's cost-optimized routing to prefer cheaper models. Higher weight = pricier. For precise costs, track usage tokens against a real pricing table.

A chat-completion backend (Anthropic, OpenAI, a local model, …).

A normalized provider response.

An agent's role: its capabilities, system prompt, goals and delegation policy.

Telemetry events emitted across AgentSea. Attach handlers — a Logger, a Prometheus exporter, or a Phoenix LiveView dashboard — to observe agent, provider, tool, and crew activity without any bespoke event bus.

A callable tool. A tool is a module implementing this behaviour — introspectable, testable, and supervisable. The parameter schema is a NimbleOptions keyword spec (not Zod), used both to validate calls and to advertise the tool to providers.

A runtime (function-backed) tool, for tools that can't be compile-time modules — e.g. ad-hoc closures or tools discovered dynamically (MCP). An agent accepts these alongside AgentSea.Tool modules in its tools list.

A tool invocation requested by the model.