Module: AgentRuntime

Defined in:
lib/agent_runtime.rb,
lib/agent_runtime/fsm.rb,
lib/agent_runtime/agent.rb,
lib/agent_runtime/state.rb,
lib/agent_runtime/errors.rb,
lib/agent_runtime/policy.rb,
lib/agent_runtime/planner.rb,
lib/agent_runtime/version.rb,
lib/agent_runtime/decision.rb,
lib/agent_runtime/executor.rb,
lib/agent_runtime/agent_fsm.rb,
lib/agent_runtime/audit_log.rb,
lib/agent_runtime/tool_registry.rb

Overview

AgentRuntime provides a deterministic, policy-driven runtime for building tool-using LLM agents with explicit state, policy enforcement, and auditability.

The library provides two main agent implementations:

  • Agent: Simple step-by-step execution with multi-step loops

  • AgentFSM: Formal finite state machine implementation following the canonical agentic workflow

Examples:

Basic usage with Agent

planner = AgentRuntime::Planner.new(client: ollama_client, schema: schema, prompt_builder: builder)
policy = AgentRuntime::Policy.new
executor = AgentRuntime::Executor.new(tool_registry: tools)
state = AgentRuntime::State.new
agent = AgentRuntime::Agent.new(planner: planner, policy: policy, executor: executor, state: state)
result = agent.run(initial_input: "What is the weather?")

Using AgentFSM for formal workflows

agent_fsm = AgentRuntime::AgentFSM.new(
  planner: planner,
  policy: policy,
  executor: executor,
  state: state,
  tool_registry: tools
)
result = agent_fsm.run(initial_input: "Analyze this data")

See Also:

Defined Under Namespace

Classes: Agent, AgentFSM, AuditLog, Decision, Error, ExecutionError, Executor, FSM, MaxIterationsExceeded, Planner, Policy, PolicyViolation, State, ToolNotFound, ToolRegistry, UnknownAction

Constant Summary collapse

VERSION =

Current version of the AgentRuntime gem.

Returns:

  • (String)

    Version string in semantic versioning format

"0.2.0"