Core Concepts

Hugin is built around a state machine architecture where agents execute tasks by pushing interactions onto a stack. This model enables powerful features like step-through debugging, branching for parallel exploration, and easy replay.

Philosophy

Hugin is motivated by a few key beliefs:

Building Blocks

Agents

The main entity that executes tasks. Contains a stack of interactions and references to config and session.

Stacks & Interactions

The interaction stack is the heart of Hugin. Every agent step is an interaction pushed onto the stack.

Tools

Functions that agents can call. Built-in tools for common operations, plus easy custom tool development.

Architecture Overview

Session (manages multiple agents)
├── Environment (registries + storage)
│   ├── ConfigRegistry (agent configurations)
│   ├── TaskRegistry (task definitions)
│   ├── TemplateRegistry (Jinja2 templates)
│   └── ToolRegistry (available tools)
└── Agents
    └── Agent
        ├── Config (behavior definition)
        ├── Task (initial prompt + parameters)
        └── Stack (interaction history)
            ├── TaskDefinition
            ├── AskOracle
            ├── OracleResponse
            ├── ToolCall
            ├── ToolResult
            └── ...

Key Features

Dynamic Configuration

Change an agent's tools, task, or even its system prompt at runtime. The context is rendered fresh with each LLM call.

Branching

Create parallel exploration paths from any point in the stack. Each branch has its own isolated context while sharing the history up to the branch point.

Multi-Agent Support

Run multiple agents in a session with shared state via namespaces. Agents can communicate through the session's state system with fine-grained access control.

Memory Model

Visual Debugging

The agent monitor provides real-time visualization of agent flows, tool calls, and decision trees.