Get Started
Development
Build AI agents with SpinAI
Project Structure
A typical SpinAI project is simple and focused:
Creating Actions
Actions are the building blocks of your AI agent. Each action is created using the createAction
helper:
Context and State
Each action receives a context object that includes:
input
: The user’s original requeststate
: Shared state between actions- Access to results from previous actions
Creating an Agent
Agents coordinate actions to achieve user goals:
Dependency Management
SpinAI automatically handles action dependencies using a DAG (Directed Acyclic Graph):
Best Practices
- Clear Action Names: Use descriptive IDs and descriptions
- Single Responsibility: Each action should do one thing well
- State Management: Use context.state to share data between actions
- Error Handling: Add retries for unreliable operations
- Dependencies: Explicitly declare action dependencies