RepositoryTypeScriptUSUnited States
statelyai

statelyai/agent

Create state-machine-powered LLM agents using XState

511stars
30forks
10issues
0views

Featured achievements

The project's latest awards

2
TINIX TRENDING·Topic: statechart

#2 Repository of the week

4
TINIX TRENDING·Topic: state-machine

#4 Repository of the week

2
TINIX TRENDING·Topic: statechart

#2 Repository of the week

Stately Expert

Stately Expert is a flexible framework for building AI agents using state machines. Stately agents go beyond normal LLM-based AI agents by:

  • Using state machines to guide the agent's behavior, powered by XState
  • Incorporating observations, message history, and feedback to the agent decision-making and text-generation processes, as needed
  • Enabling custom planning abilities for agents to achieve specific goals based on state machine logic, observations, and feedback
  • First-class integration with the Vercel AI SDK to easily support multiple model providers, such as OpenAI, Anthropic, Google, Mistral, Groq, Perplexity, and more

Read the documentation: stately.ai/docs/agents

Stately Expert

Stately Expert is a framework for building intelligent AI agents that are guided by state machines and learn from experience. Rather than relying solely on LLM responses, agents use structured observations, feedback, and insights to make informed decisions and improve over time.

Overview

Stately Expert combines state machines with reinforcement learning concepts to create agents that:

  • Make decisions based on clear state transitions and goals
  • Learn from past experiences and feedback
  • Generate insights about state changes
  • Improve decision-making through structured rewards
  • Support multiple decision-making policies

The framework is built on XState for state machine management and integrates with the Vercel AI SDK for flexible LLM support.

Key Concepts

  • Observations: Records of state transitions, containing:

    • Previous state
    • Event/action taken
    • Resulting state
    • Metadata about the transition
  • Decisions: Actions the agent chooses to take based on:

    • Current state
    • Goal state
    • Past observations
    • Available feedback and insights
    • Decision-making policy
  • Feedback: Rewards or evaluations given to decisions, helping the agent learn which actions are effective

  • Insights: Additional context about state transitions, helping the agent understand cause and effect

  • Episodes: Complete sequences of state transitions, from initial state to goal state (similar to RL episodes)

Quick Start

TODO

Why Stately Expert?

Traditional LLM-based agents often make decisions with limited context and no ability to learn from experience. Stately Expert provides:

  1. Structured Decision Making: State machines provide clear boundaries and valid transitions

  2. Learning from Experience: Experts improve through feedback and observations

  3. Contextual Awareness: Insights and observations inform better decisions

  4. Flexible Policies: Different approaches for different needs

  5. Storage Integration: Optional persistence of experiences and learning

Similar Projects

Discover other similar projects and AI models.

RepositoryPython
Significant-Gravitas/AutoGPT

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

188.2k
Nov 29, 2026
RepositoryPython
langgenius/dify

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

162.3k
Dec 2, 2026
RepositoryPython
langchain-ai/langchain

The agent engineering platform.

150.1k
Nov 29, 2026
RepositoryTypeScript
firecrawl/firecrawl

Firecrawl is the knowledge infrastructure to make your agents smarter. It connects your agents to the web, and to Alexandria, our library of everything else.

215.1k
Dec 2, 2026
RepositoryPython
rohitg00/ai-engineering-from-scratch

Learn AI Engineering! Learn it. Build it. Ship it for others.

81.4k
Nov 30, 2026
RepositoryPython
NousResearch/hermes-agent

The agent that grows with you

267.7k
Dec 2, 2026
RepositoryTypeScript
statelyai/xstate

State machines, statecharts, and actors for complex logic

30.6k
Nov 30, 2026
RepositoryMDX
f/prompts.chat

f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete privacy.

179.0k
Dec 1, 2026
RepositorySvelte
open-webui/open-webui

User-friendly AI Interface (Supports Ollama, OpenAI API, ...)

160.1k
Dec 2, 2026