AgentSea.Agent (agentsea_core v0.1.0)

Copy Markdown

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.

Dependencies (provider, tools) are resolved from the Config struct, not injected via a constructor. A tool that raises is isolated by a supervised Task and folded into an {:error, _} result fed back to the model — the agent process never dies for a tool fault.

Summary

Functions

Produce a bid for a task, based on the agent's role/capabilities and model price tier. Pure (no provider call) — used by the auction delegation strategy. The task may be any map/struct exposing :id, :description and :required_capabilities.

Returns a specification to start this module under a supervisor.

Return the accumulated conversation history (excludes the system prompt).

Clear the conversation history.

Run the agentic loop for input. Blocks the caller (not the scheduler).

Start an agent process from a Config.

Functions

bid(agent, task)

Produce a bid for a task, based on the agent's role/capabilities and model price tier. Pure (no provider call) — used by the auction delegation strategy. The task may be any map/struct exposing :id, :description and :required_capabilities.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

history(agent)

Return the accumulated conversation history (excludes the system prompt).

reset(agent)

Clear the conversation history.

run(agent, input, ctx \\ %{})

Run the agentic loop for input. Blocks the caller (not the scheduler).

start_link(config, opts \\ [])

Start an agent process from a Config.