gptel agentic framework based around state machines

Posted on August 22, 2026 by Ivan Dimitrov

LLM Agent Framework Design and Task Breakdown

Overview

A framework to coordinate multiple GPTel preset-based agents, each assigned a subproblem of a main goal. Each agent runs in its own buffer and agents coordinate by following a defined state machine until the main goal is achieved.

Goals

  • Modularity: Easy to define, add, and remove agents.
  • Coordination: Agents communicate results and triggers.
  • Transparency: Each agent’s state and buffer visible.
  • Deterministic Completion: The orchestrator knows when the main goal is achieved.

Components

  • Orchestrator: Controls agents, state, and messaging.
  • Agents: Encapsulated GPTel presets + buffers.
  • State Machine: Defines agent states and transitions.
  • Buffers: One per agent, storing context and logs.

Implementation Tasks

Define Agent Data Model

  • Document required fields (preset, buffer, state, dependencies, etc).
  • Decide on struct/list/object for in-memory representation.

Design Global Orchestrator

  • Orchestrator holds agent list and state.
  • Functions for initializing, updating, and finishing workflows.
  • Plan hooks/callbacks for response arrival and step advancement.

Specify State Machine

  • Enumerate agent states (Idle, Submitted, Waiting, Running, Completed, Error).
  • Draft allowed transitions and state diagrams.
  • Define transition triggers (incoming data, dependencies, timers).

Agent Buffer Integration

  • Create buffers named after agent roles (e.g., llm-agent-research).
  • Write functions to initialize and update buffers.
  • Connect buffers to orchestrator state.

Agent Lifecycle and Execution

  • Implement agent task initiation: send context/prompt to GPTel.
  • Handle output: parse, store in buffer, notify orchestrator.
  • Document interface between orchestrator and agent buffers.

Agent Coordination

  • Implement message passing or result handoff between agents (via orchestrator).
  • Document how dependencies are tracked and checked.

Goal/Termination Conditions

  • Formalize how orchestrator knows when main goal is achieved.
  • Plan for error handling and recovery.

User Interaction and Monitoring

  • Optional: Provide ways to inspect or steer agent buffers and state.

Example Use Case (Documented)

  1. User defines a main problem and subproblems mapped to agents.
  2. Each agent buffer is created and initialized with its GPTel preset.
  3. Orchestrator triggers agents based on dependencies.
  4. Agent finishes a task, writes output to its buffer.
  5. Orchestrator advances state, possibly triggering downstream agents.
  6. When all requirements met, orchestrator marks goal as completed.

Future Enhancements

  • Parallel agent execution (async triggers)
  • Visualizations of agent progress and states
  • Dynamic agent creation/removal during workflow