Lux.Agent behaviour (Lux v0.5.0)
View SourceA Agent defines an autonomous agent's capabilities, behaviors and goals. The actual execution and supervision is handled by the Lux runtime.
Agents can be configured with different templates that provide specialized behaviors:
- :company_agent - Adds company-specific signal handling
- (other templates to be added)
Example
defmodule MyCompanyAgent do
use Lux.Agent,
template: :company_agent,
template_opts: %{
llm_config: %{temperature: 0.7}
} do
def init(opts) do
{:ok, opts}
end
# Can override template functions if needed
def handle_task_assignment(signal, context) do
# Custom implementation
end
end
end
Summary
Functions
Creates an agent module from JSON configuration.
See Lux.Agent.Loaders.from_json/1
for details.
Types
@type collaboration_protocol() :: :ask | :tell | :delegate | :request_review
@type scheduled_action() :: {module(), pos_integer(), map(), map()}
@type t() :: %Lux.Agent{ accepts_signals: [Lux.SignalSchema.t()], beams: [Lux.Beam.t()], description: String.t(), goal: String.t(), id: String.t(), lenses: [Lux.Lens.t()], llm_config: map(), memory_config: memory_config() | nil, memory_pid: pid() | nil, module: module(), name: String.t(), prisms: [Lux.Prism.t()], scheduled_actions: [scheduled_action()], signal_handlers: [signal_handler()], template: atom(), template_opts: map() }