motia

motia

AI Agent Framework For Software Engineers

Stars: 461

Visit
 screenshot

Motia is an AI agent framework designed for software engineers to create, test, and deploy production-ready AI agents quickly. It provides a code-first approach, allowing developers to write agent logic in familiar languages and visualize execution in real-time. With Motia, developers can focus on business logic rather than infrastructure, offering zero infrastructure headaches, multi-language support, composable steps, built-in observability, instant APIs, and full control over AI logic. Ideal for building sophisticated agents and intelligent automations, Motia's event-driven architecture and modular steps enable the creation of GenAI-powered workflows, decision-making systems, and data processing pipelines.

README:

Logo

AI Agent Framework Built for Software Engineers

Project Page Discord Documentation NPM Version NPM Downloads

Motia lets developers create, test, and deploy production-ready AI agents in minutes, in a framework that will feel familar to software engineering teams. Write your agent logic in the languages and package you know and love. Visualize execution in real-time, and deploy without DevOps headaches.

The Problem Motia Solves

Building production-grade AI agents is tough. You're usually forced to choose:

  • No-code/Low-code tools: Quick to start, but can't handle real-world complexity at scale.
  • Fully-agentic Frameworks: Great for creative tasks but difficult to manage and control consistent outputs
  • ML-focused Frameworks: Designed for model training and optimization, not for orchestrating complex business workflows.
  • Custom code: Quickly becomes unmanageable as agents grow in complexity and span across teams.

Motia gives you full, code-first control of your agents and automations with the simplicity of a visual interface, letting you focus on what truly matters: your business logic, not your infrastructure.

Motia Example

Why Choose Motia?

Motia is built for developers who want to build agentic and intelligent, event-driven systems rapidly and reliably. Here's what makes Motia the ideal choice:

  • πŸš€ Zero Infrastructure Headaches - No Kubernetes expertise required. Deploy agents with a single command.
  • πŸ’» True Code-First Development - Write agent logic in familiar languages, not proprietary DSLs.
  • πŸ”€ Unique Multi-Language Support - Mix Python for ML, TypeScript for type safety, and Ruby for APIs in the same agent.
  • 🧩 Composable Steps with Runtime Validation - Build agents from modular, reusable components with automatic input/output validation.
  • πŸ“Š Built-in Observability - Debug agent behavior with visual execution graphs and real-time logging.
  • ⚑️ Instant APIs & Webhooks - Expose agent functionality via HTTP endpoints without extra code.
  • 🧠 Full Control Over AI Logic - Use any LLM, vector store, or reasoning pattern without restrictions.
  • πŸ€Έβ€β™€οΈ Flexible Control - Easilty switch between agentic and deterministic control within the same flow.

Ideal for Agents & Intelligent Automations

Motia's event-driven architecture and modular steps are perfectly suited for building sophisticated agents and intelligent automations. Whether you're creating GenAI-powered workflows, complex decision-making systems, or data processing pipelines, Motia provides the ideal foundation.

  • Create Agent Components as Steps: Encapsulate agent logic, tool integrations, and decision-making processes within individual steps, leveraging the rich ecosystems of JavaScript, Python, and Ruby.
  • Orchestrate Agent Interactions with Flows: Design complex agentic workflows by connecting steps to create sophisticated sequences of actions and reactions, easily integrating steps written in different languages.
  • Test and Evaluate Agent Behavior Visually: The Motia Workbench provides real-time visualization and testing tools to observe and refine your agents' behavior and ensure they perform as expected, regardless of the underlying step language.
  • Iterate and Evolve Agents Rapidly: Motia's modularity and observability make it easy to iterate on agent logic, experiment with different approaches, and continuously improve your intelligent systems, taking advantage of the strengths of each supported language.

Motia Workbench: Your Visual Control Center

The Motia Workbench is your browser-based development environment.

Motia Workbench Interface

  • Interactive Flow Visualization: See your steps connected in a dynamic, visual graph. Understand event flow and step interactions at a glance.
  • Real-time Testing: Trigger API endpoints and emit events directly from the UI to test your flows and agents in real-time.
  • Live Log Streaming: Monitor logs in real-time within the Workbench, making debugging and observing execution a breeze.
  • Step Customization: Create custom UI components for your steps to enhance visualization and tailor the Workbench to your workflows.

Quick Start

Ready to get started in minutes? Follow these simple steps using pnpm and the automated project creation:

  1. Create a new project using the Motia CLI:

    npx motia create -n my-first-agent

    (Replace my-first-agent with your desired project name)

    This command will:

    • Create a new folder my-first-agent
    • Set up a basic Motia project with example steps
    • Install dependencies using pnpm
  2. Navigate into your new project directory:

    cd my-first-agent
  3. Start the Motia development server:

    pnpm run dev
  4. Open the Motia Workbench in your browser (usually http://localhost:3000). You should see a pre-built flow named "default" with example steps visualized.

  5. Test an example API Step: In your terminal, use curl to trigger the example API endpoint (often /default in the default template):

    curl -X POST http://localhost:3000/default \
    -H "Content-Type: application/json" \
    -d '{}'

    Alternatively, use the Motia CLI to emit an event (for event-based steps in the template):

    npx motia emit --topic test-state --message '{}'

    Check the Workbench logs – you should see logs indicating the step execution and event flow!

Congratulations! You've just created and run your first Motia workflow using the automated project setup.

Start building your AI powered agents with simple steps

  • Configure a simple to emit/subscribe, assign to a flow and inculde runtime validation
  • Define a function to handle when the step is triggered
  • Import any package
import { OpenAI } from 'openai';
import { z } from 'zod';
import type { EventConfig, StepHandler } from 'motia';

const openai = new OpenAI({
    apiKey: process.env.OPENAI_API_KEY,
});

export const config: EventConfig = {
  type: 'event',
  name: 'Auto-Reply to Support Emails',
  subscribes: ['email.received'],
  emits: ['email.send'],
  flows: ['email-support'],
  input: z.object({ subject: z.string(), body: z.string(), from: z.string() }),
};

export const handler: StepHandler<typeof config> = async (inputData, context) => {
  const { subject, body, from } = inputData;
  const { emit, logger } = context;

  const sentimentResponse = await openai.chat.completions.create({
    model: "gpt-4o",
    messages: [{ role: "user", content: `Analyze the sentiment of the following text: ${body}` }],
  });

  const sentiment = sentimentResponse.choices[0].message.content;

  logger.info('[EmailAutoReply] Sentiment analysis', { sentiment });

  emit({
    type: 'email.send',
    data: { from, subject, body, sentiment },
  });
};

Next Steps

  • Dive into the Documentation: Explore the full Motia documentation to understand core concepts, step types, state management, and more.
  • Explore Examples: Check out practical examples to see Motia in action and get inspiration for your own workflows and agents.
  • Join the Community: Connect with other Motia users and the development team on our Discord server and contribute to the project on GitHub.

License: MIT

For Tasks:

Click tags to check more tools for each tasks

For Jobs:

Alternative AI tools for motia

Similar Open Source Tools

For similar tasks

For similar jobs