United Statesstatelyai/agent
Create state-machine-powered LLM agents using XState
Featured achievements
The project's latest awards
#2 Repository of the week
#4 Repository of the week
#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:
-
Structured Decision Making: State machines provide clear boundaries and valid transitions
-
Learning from Experience: Experts improve through feedback and observations
-
Contextual Awareness: Insights and observations inform better decisions
-
Flexible Policies: Different approaches for different needs
-
Storage Integration: Optional persistence of experiences and learning
Similar Projects
Discover other similar projects and AI models.
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.
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.
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.
Learn AI Engineering! Learn it. Build it. Ship it for others.
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.