AgenthubSdk behaviour (AgentHub SDK v1.0.2)

View Source

Simple interface to make agents runnable on AgentHub.

This module provides the core behavior for creating agent runners that can be executed on the AgentHub platform.

Summary

Callbacks

Defines the behavior for an agent runner.

Functions

Runs an agent with the given input.

Callbacks

run(input)

@callback run(input :: any()) :: {:ok, any()} | {:error, any()}

Defines the behavior for an agent runner.

An agent runner must implement the run/1 callback which takes input and returns a result wrapped in a task or async operation.

Functions

run(agent_module, input)

@spec run(module(), any()) :: {:ok, any()} | {:error, any()}

Runs an agent with the given input.

This function provides a standardized way to execute agents that implement the AgentRunner behavior.

Parameters

  • agent_module - The module implementing the AgentRunner behavior
  • input - The input data to pass to the agent

Returns

  • {:ok, result} - On successful execution
  • {:error, reason} - On failure

Examples

iex> AgenthubSdk.run(MyAgent, %{data: "test"})
{:ok, %{result: "processed"}}