Skip to content

hiwcode/atelier-workflow-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Todo App — Atelier Event Integration Demo

A simple todo app that emits events to Atelier on every operation. Use it to see how external apps trigger agent workflows via Atelier's event system.

Events Emitted

Event When Payload
todo.created A new todo is added {id, title, description, priority, completed, created_at}
todo.updated A todo is edited {...todo, changes: {fields that changed}}
todo.completed A todo is marked done {id, title, description, priority, completed, created_at}
todo.deleted A todo is removed {id, title, description, priority, completed, created_at}

Setup

# 1. Install dependencies
uv sync

# 2. Configure Atelier connection
cp .env.example .env
# Edit .env with your Atelier URL and API key

# 3. Run

Open http://127.0.0.1:3001

Environment Variables

Variable Description Default
ATELIER_URL Atelier backend URL (empty — events skipped)
ATELIER_API_KEY Your per-user API key from Atelier Config page (empty — events skipped)

How It Works

  1. Todo app — a FastAPI app with an in-memory store and a single-file HTML frontend. CRUD operations on todos.
  2. Event integration (integration.py) — a thin emit_event() helper that POSTs to Atelier's /api/v1/events endpoint with an event type and payload. Fire-and-forget: if Atelier is unreachable, the todo operation still succeeds.
  3. Atelier side — in the Atelier UI, create a workflow that subscribes to todo.* (or a specific event like todo.completed). When the todo app emits a matching event, Atelier queues a run and your agent processes it.

Example Workflow

In Atelier, create a workflow:

  • Event type: todo.completed
  • Agent: your agent
  • Instructions: "When a todo is completed, send a congratulations notification to the user."

Now when you check off a todo in this app, Atelier's agent runs automatically.

MCP Tools

The same server exposes todo operations as MCP tools at http://127.0.0.1:3001/mcp.

In Atelier, add an MCP connection:

  • URL: http://127.0.0.1:3001/mcp
  • Transport: Streamable HTTP

Available tools: list_todos, get_todo, create_todo, update_todo, toggle_todo, delete_todo.

This lets your Atelier agents manage todos directly — e.g., a workflow triggered by todo.completed can call list_todos to check if all are done, then create_todo to add a new one.

Project Structure

todo-app/
  main.py           # FastAPI app + HTML frontend + MCP mount
  mcp_tools.py      # MCP tool definitions
  integration.py    # Atelier event emitter
  pyproject.toml    # Dependencies
  .env.example      # Environment template

API Endpoints

Method Path Description
GET / HTML frontend
GET /api/todos List all todos
POST /api/todos Create a todo
PATCH /api/todos/{id} Update a todo
DELETE /api/todos/{id} Delete a todo
POST /api/todos/{id}/toggle Toggle completed

About

A simple todo app that emits events to Atelier on every operation. Use it to see how external apps trigger agent workflows via Atelier's event system.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages