What is SpinAI?

SpinAI is a lightweight TypeScript framework for building AI agents that can:

  • Execute actions in a specific order
  • Maintain state between actions
  • Make decisions using any LLM
  • Handle complex dependencies

Key Concepts

Agents

Agents are the core of SpinAI. They:

  • Receive user input
  • Decide which actions to take
  • Execute actions in the correct order
  • Provide responses back to users
const agent = createAgent({
  instructions: "Help users with support tickets",
  actions: [getCustomerInfo, createTicket],
  llm: createOpenAILLM({ apiKey: process.env.OPENAI_API_KEY }),
});

Actions

Actions are discrete tasks that your agent can perform:

  • Have clear inputs and outputs
  • Maintain state through context
  • Can depend on other actions
  • Are executed in DAG order
const getCustomerInfo = createAction({
  id: "getCustomerInfo",
  description: "Retrieves customer information",
  async run(context) {
    context.state.customer = await fetchCustomer();
    return context;
  },
});

Context

Context flows through your actions:

  • Preserves state between actions
  • Carries the original user input
  • Accumulates results as actions run

Why SpinAI?

  • 🎯 Focused: Built specifically for action-oriented AI agents
  • 🔄 Flexible: Works with any LLM that supports chat completions
  • 📦 Simple: Minimal boilerplate, maximum productivity
  • 🛠️ Type-safe: Built with TypeScript for robust development
  • 🪶 Light: Zero dependencies beyond your chosen LLM

Next Steps