Skip to main content

Usage

crewship invoke [options]

Description

Triggers a new run of your deployed crew. You can pass input data and stream events in real-time.

Options

OptionDescription
--input <json>JSON input to pass to your crew
--input-file <path>Read input from a JSON file
--streamStream events in real-time
--project <name>Project to invoke (defaults to current directory)
--deployment <id>Specific deployment to run (defaults to latest)
--waitWait for completion and show result
--timeout <seconds>Maximum time to wait (default: 300)

Examples

Basic invocation

crewship invoke --input '{"topic": "AI agents"}'
Output:
▶ Run started: run_abc123xyz
  Status: running

Use `crewship runs get run_abc123xyz` to check status.

Stream events

crewship invoke --input '{"topic": "quantum computing"}' --stream
Real-time output:
▶ Run started: run_abc123xyz
├─ [10:30:01] Researcher agent starting task...
├─ [10:30:15] Tool: web_search("quantum computing breakthroughs 2024")
├─ [10:30:18] Researcher agent completed task
├─ [10:30:19] Writer agent starting task...
├─ [10:30:45] Writer agent completed task
├─ [10:30:46] Artifact: research_report.md (4.2 KB)
✅ Run completed in 45.2s

Input from file

# Create input file
echo '{"topic": "machine learning", "style": "technical"}' > input.json

# Invoke with file
crewship invoke --input-file input.json

Wait for result

crewship invoke --input '{"query": "test"}' --wait
The CLI waits for completion and shows the final result:
▶ Run started: run_abc123xyz
⏳ Waiting for completion...
✅ Run completed in 32.1s

Result:
{
  "output": "Generated report content...",
  "artifacts": ["report.md"]
}

Invoke specific deployment

# Invoke a previous deployment (for testing)
crewship invoke --deployment dep_xyz789 --input '{"test": true}'

Input Format

Input must be valid JSON:
# Object
crewship invoke --input '{"key": "value"}'

# With nested data
crewship invoke --input '{"user": {"name": "Alice", "preferences": ["fast", "detailed"]}}'
Your crew receives this as the inputs parameter:
def kickoff(inputs: dict):
    topic = inputs.get("key")
    user_name = inputs.get("user", {}).get("name")

Event Types

When streaming, you’ll see these event types:
EventDescription
▶ Run startedRun execution began
├─ [time] messageLog from your crew
├─ Tool: name(args)Tool was invoked
├─ Artifact: nameFile was produced
✅ Run completedSuccess
❌ Run failedError occurred

Handling Errors

If a run fails:
crewship invoke --input '{"bad": "input"}' --stream
▶ Run started: run_abc123xyz
├─ [10:30:01] Starting crew execution...
├─ [10:30:02] Error: Missing required field 'topic'
❌ Run failed after 1.2s

Error: CrewExecutionError: Missing required field 'topic'

Programmatic Usage

For scripts and automation:
# Get run ID
RUN_ID=$(crewship invoke --input '{"topic": "test"}' --json | jq -r '.run_id')

# Poll for status
crewship runs get $RUN_ID --json