View Source SwarmEx.Agent behaviour (SwarmEx v0.1.0)
Defines the behavior and implementation for SwarmEx agents.
Each agent in the SwarmEx system is a process that can:
- Process messages from other agents or clients
- Execute tools and handle their results
- Maintain internal state
- Participate in agent networks
Example
defmodule MyAgent do
use SwarmEx.Agent
def init(opts) do
# Initialize agent state
{:ok, opts}
end
def handle_message(msg, state) do
# Handle incoming message
{:ok, response, state}
end
def handle_tool(tool_name, args, state) do
# Execute tool functionality
{:ok, result, state}
end
end
Summary
Functions
Creates a new agent process with the given module and options.
Stops an agent process.
Validates the agent implementation to ensure all required callbacks are implemented correctly.
Types
Callbacks
Functions
Creates a new agent process with the given module and options.
Stops an agent process.
Validates the agent implementation to ensure all required callbacks are implemented correctly.