Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions examples/advanced-use-cases/ai-room-renovate/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
modules:
- class: modules::stream::StreamModule
config:
port: ${STREAMS_PORT:3112}
host: 127.0.0.1
adapter:
class: modules::stream::adapters::KvStore
config:
store_method: file_based
file_path: ./data/streams_store

- class: modules::state::StateModule
config:
adapter:
class: modules::state::adapters::KvStore
config:
store_method: file_based
file_path: ./data/state_store.db

- class: modules::api::RestApiModule
config:
port: 3111
host: 127.0.0.1
default_timeout: 30000
concurrency_request_limit: 1024
cors:
allowed_origins:
- '*'
allowed_methods:
- GET
- POST
- PUT
- DELETE
- OPTIONS

- class: modules::observability::OtelModule
config:
enabled: ${OTEL_ENABLED:true}
service_name: ${OTEL_SERVICE_NAME:iii-engine}
service_version: ${SERVICE_VERSION:0.2.0}
service_namespace: ${SERVICE_NAMESPACE:production}
Comment on lines +39 to +41

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Default SERVICE_NAMESPACE of "production" is misleading for a dev/example project.

If a developer runs this example with a real OTLP backend without setting SERVICE_NAMESPACE, all traces/metrics will be tagged as belonging to the production namespace.

✏️ Suggested fix
-      service_namespace: ${SERVICE_NAMESPACE:production}
+      service_namespace: ${SERVICE_NAMESPACE:development}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
service_name: ${OTEL_SERVICE_NAME:iii-engine}
service_version: ${SERVICE_VERSION:0.2.0}
service_namespace: ${SERVICE_NAMESPACE:production}
service_name: ${OTEL_SERVICE_NAME:iii-engine}
service_version: ${SERVICE_VERSION:0.2.0}
service_namespace: ${SERVICE_NAMESPACE:development}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/advanced-use-cases/ai-room-renovate/config.yaml` around lines 39 -
41, The default SERVICE_NAMESPACE in config.yaml is set to "production" which is
misleading for an example; change the default placeholder for service_namespace
(the SERVICE_NAMESPACE env var) to a non-production value like "example" or
leave it empty/null so developers don't accidentally tag traces as production;
update the service_namespace: ${SERVICE_NAMESPACE:production} entry to use
${SERVICE_NAMESPACE:example} (or remove the default) so service_namespace and
SERVICE_NAME/service_version defaults reflect an example/dev context.

exporter: ${OTEL_EXPORTER_TYPE:memory}
endpoint: ${OTEL_EXPORTER_OTLP_ENDPOINT:http://localhost:4317}
sampling_ratio: 1.0
memory_max_spans: ${OTEL_MEMORY_MAX_SPANS:10000}
metrics_enabled: true
metrics_exporter: ${OTEL_METRICS_EXPORTER:memory}
metrics_retention_seconds: 3600
metrics_max_count: 10000
logs_enabled: ${OTEL_LOGS_ENABLED:true}
logs_exporter: ${OTEL_LOGS_EXPORTER:memory}
logs_max_count: ${OTEL_LOGS_MAX_COUNT:1000}
logs_retention_seconds: ${OTEL_LOGS_RETENTION_SECONDS:3600}
logs_sampling_ratio: ${OTEL_LOGS_SAMPLING_RATIO:1.0}

- class: modules::queue::QueueModule
config:
adapter:
class: modules::queue::BuiltinQueueAdapter

- class: modules::pubsub::PubSubModule
config:
adapter:
class: modules::pubsub::LocalAdapter

- class: modules::cron::CronModule
config:
adapter:
class: modules::cron::KvCronAdapter

- class: modules::shell::ExecModule
config:
watch:
- steps/**/*.ts

exec:
- npx motia dev
- bun run --enable-source-maps dist/index-dev.js
Comment on lines +71 to +78

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, locate and examine the config.yaml file
find . -name "config.yaml" -path "*/ai-room-renovate/*" | head -5

Repository: MotiaDev/motia-examples

Length of output: 125


🏁 Script executed:

# Check the repository structure to understand the project better
ls -la examples/advanced-use-cases/ai-room-renovate/ 2>/dev/null || echo "Directory not found"

Repository: MotiaDev/motia-examples

Length of output: 1051


🏁 Script executed:

# Search for Motia documentation or ExecModule references in the repo
find . -type f \( -name "*.md" -o -name "*.ts" -o -name "*.js" \) -exec grep -l "ExecModule\|motia" {} \; | head -20

Repository: MotiaDev/motia-examples

Length of output: 31238


🌐 Web query:

Motia ExecModule multiple exec entries sequential parallel execution behavior

💡 Result:

In Motia’s config.yaml, the iii Shell ExecModule treats config.exec as an ordered list: the commands are executed in order (sequentially), not in parallel. This is why the default dev setup runs a build command first (npx motia dev) and then starts the output (node dist/index-dev.js). When watched files change, the exec commands are re-run. [1]

If you need “parallel” behavior, you generally have to do it yourself inside a single exec entry using your shell (e.g., backgrounding with &, concurrently, etc.), because multiple exec: list items are intended to be ordered steps, not concurrent processes. [1]

Sources
[1] Motia Docs — “Configuration (config.yaml)” (Shell Exec module; “exec — commands to execute in order”) https://www.motia.dev/docs/development-guide/motia-config


🏁 Script executed:

# Read the config.yaml file to see the actual content at lines 71-78
cat -n examples/advanced-use-cases/ai-room-renovate/config.yaml | sed -n '60,85p'

Repository: MotiaDev/motia-examples

Length of output: 754


🏁 Script executed:

# Read the package.json to understand what these scripts do
cat examples/advanced-use-cases/ai-room-renovate/package.json

Repository: MotiaDev/motia-examples

Length of output: 705


🏁 Script executed:

# Check if there's any documentation in the repo about ExecModule or the intended behavior
cat examples/advanced-use-cases/ai-room-renovate/README.md | head -100

Repository: MotiaDev/motia-examples

Length of output: 3430


The two exec commands are executed sequentially; the second will never start.

Motia's ExecModule runs commands in the exec list in order, not in parallel. Since npx motia dev is a long-running dev/build server that doesn't exit, bun run --enable-source-maps dist/index-dev.js will never execute.

Looking at the rest of the config, there's already a separate ExecModule for Python files (lines 80+), suggesting TypeScript and Python should also be separate. Split these into two ExecModule entries:

  • One for npx motia dev watching steps/**/*.ts
  • One for bun run ... watching the built output (or handle both in a single shell command using &)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/advanced-use-cases/ai-room-renovate/config.yaml` around lines 71 -
78, The ExecModule currently lists two exec commands under the same module
(exec: - npx motia dev - bun run --enable-source-maps dist/index-dev.js) which
run sequentially so the long-running `npx motia dev` blocks the `bun run`
command; fix it by splitting into two ExecModule entries: one ExecModule with
watch: ["steps/**/*.ts"] and exec: ["npx motia dev"] (for the dev server), and a
separate ExecModule that watches the built output (or appropriate pattern) and
runs exec: ["bun run --enable-source-maps dist/index-dev.js"] so both processes
can run concurrently (or alternatively run both in a single shell command using
`&` if you intend a single module).


- class: modules::shell::ExecModule
config:
watch:
- steps/**/*.py

exec:
- uv run motia run --dir steps
62 changes: 0 additions & 62 deletions examples/advanced-use-cases/ai-room-renovate/motia-workbench.json

This file was deleted.

9 changes: 0 additions & 9 deletions examples/advanced-use-cases/ai-room-renovate/motia.config.ts

This file was deleted.

20 changes: 5 additions & 15 deletions examples/advanced-use-cases/ai-room-renovate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,20 @@
"version": "1.0.0",
"description": "AI Home Renovation Planner - A multi-agent Motia workflow that analyzes photos, creates personalized renovation plans, and generates comprehensive project roadmaps",
"scripts": {
"postinstall": "motia install",
"dev": "motia dev",
"generate-types": "motia generate-types",
"build": "motia build",
"clean": "rm -rf dist node_modules python_modules .motia .mermaid"
"start": "bun run --enable-source-maps dist/index-dev.js",
"dev": "iii",
"dev:py": "uv run motia dev --dir steps --watch",
"build": "npx motia dev"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

"build": "npx motia dev" is semantically wrong — this starts a dev server, not a build.

Running npm run build in CI or during deployment will spin up a long-running dev server instead of producing artifacts. If the intent is to compile TypeScript to dist/, this command should be the TypeScript compilation step. If npx motia dev is intentional (i.e., it performs a one-shot code generation step), rename the script to something unambiguous like "dev:ts".

✏️ Suggested fix
-    "build": "npx motia dev"
+    "dev:ts": "npx motia dev"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"build": "npx motia dev"
"dev:ts": "npx motia dev"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/advanced-use-cases/ai-room-renovate/package.json` at line 9, The
"build" script currently runs "npx motia dev" which starts a dev server rather
than producing build artifacts; change the "build" script to perform a one-shot
build (for example "tsc -p tsconfig.json" or your project's actual build
command) and move "npx motia dev" to a clearly named dev script such as
"dev:motia" or "motia:dev" so "build" is safe for CI/deploy; update the "build"
and new dev script names in package.json accordingly, ensuring any CI references
use the new "build" script.

},
"keywords": [
"motia"
],
"dependencies": {
"@motiadev/core": "^0.9.0-beta.145",
"@motiadev/plugin-endpoint": "^0.9.0-beta.145",
"@motiadev/plugin-logs": "^0.9.0-beta.145",
"@motiadev/plugin-observability": "^0.9.0-beta.145",
"@motiadev/plugin-states": "^0.9.0-beta.145",
"motia": "^0.9.0-beta.145",
"motia": "1.0.0-rc.14",
"zod": "^3.24.4"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@types/jest": "^29.5.14",
"@types/react": "^19.1.1",
"jest": "^29.7.0",
"ts-jest": "^29.4.5",
"ts-node": "^10.9.2",
"typescript": "^5.7.3"
}
Expand Down
20 changes: 20 additions & 0 deletions examples/advanced-use-cases/ai-room-renovate/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[project]
name = "ai-room-renovate"
version = "0.1.0"
description = "AI Home Renovation Planner"
requires-python = ">=3.10"
dependencies = [
"motia[otel]==1.0.0-rc.22",
"iii-sdk==0.2.0",
"pydantic>=2.0",
"google-adk>=0.1.0",
"google-genai>=0.2.0",
]

[project.optional-dependencies]
dev = [
"pytest>=8.0.0",
]

[tool.uv]
package = false
12 changes: 0 additions & 12 deletions examples/advanced-use-cases/ai-room-renovate/requirements.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,23 @@
* Second step in the renovation planning pipeline
*/

import { EventConfig, Handlers } from 'motia';
import { queue, Handlers, StepConfig } from 'motia';
import { z } from 'zod';
import { calculateTimeline } from '../../utils/renovation-tools';

const inputSchema = z.object({
sessionId: z.string(),
});

export const config: EventConfig = {
type: 'event',
export const config = {
name: 'DesignPlanner',
description: 'Creates detailed design plans with materials and specifications',
subscribes: ['renovation.design'],
emits: ['renovation.coordinate'],
input: inputSchema,
triggers: [queue('renovation.design', { input: inputSchema })],
enqueues: ['renovation.coordinate'],
flows: ['home-renovation'],
};
} as const satisfies StepConfig;

export const handler: Handlers['DesignPlanner'] = async (input, { emit, logger, state }) => {
export const handler: Handlers<typeof config> = async (input, { enqueue, logger, state }) => {
const { sessionId } = input;

logger.info('Starting design planning', { sessionId });
Expand Down Expand Up @@ -64,7 +62,7 @@ export const handler: Handlers['DesignPlanner'] = async (input, { emit, logger,
await state.set(sessionId, 'scope', scope);

// Emit to project coordinator
await emit({
await enqueue({
topic: 'renovation.coordinate',
data: {
sessionId,
Expand Down

This file was deleted.

Loading