Use your own AI agent
Bring the agent you already use to create, import, edit, explain, and test state machines in Stately. Your agent does the AI work; Stately provides the editor and machine tools.
These workflows use no Stately AI credits, even when your Stately AI allowance is empty.
Connect your agent
- In an MCP-compatible agent, add Stately’s server:
https://mcp.stately.ai/mcp. - Sign in to Stately and approve the projects the agent can access.
- Ask your agent to make or update a machine and open it in Stately. Review the result before saving changes.
Setup instructions for Codex, Claude Code, and other MCP clients
Use it for your Stately work
- Create or edit: describe the behavior and ask your agent to create a machine or propose changes to an existing one.
- Import a screenshot: attach the image to your agent. Ask it to read the diagram, generate XState code, and import that code into Stately.
- Understand or test: ask your agent to explain a flow, inspect paths, simulate events, or run behavior checks with Stately’s tools.
- Work on your codebase: ask a coding agent to map source behavior, propose a change, implement it, and update the saved models.
Example prompt: “Use Stately to model this checkout flow, check its success and failure paths, and open the result so I can review it. Use your own reasoning and Stately’s machine tools.”
What uses credits?
Your agent’s reasoning and Stately’s deterministic model, editing, validation, simulation, and export tools do not use Stately AI credits. Your agent provider’s own subscription or API charges may apply.
The built-in Stately AI composer and hosted AI generation, image import, and analysis endpoints use Stately AI credits. To import an image without them, have your agent interpret it and submit machine code rather than asking Stately’s hosted AI to read the image.
Your usual Stately plan and project permissions still apply to saving, private projects, collaboration, and other plan features.
Self-hosting
For a local MCP server, run npx -y @statelyai/mcp. See the local setup guide for credentials, local storage, and connecting to your own Stately deployment.