Getting Started
Quickstart Guide
Get started with Contd.ai in 5 minutes.
Prerequisites
- •Python 3.9+ or Node.js 18+
- •A Contd.ai account (sign up free)
- •An API key (create one in Settings → API Keys)
Installation
Python
terminal
pip install contd-sdkNode.js
terminal
npm install @contd/sdkGo
terminal
go get github.com/contd/sdk-goYour First Workflow
1. Define a Workflow
workflow.py
from contd import workflow, step
@workflow
async def my_first_workflow(ctx):
# Step 1: Process input
result = await ctx.run(step_one, ctx.input["message"])
# Step 2: Transform result
return await ctx.run(step_two, result)
@step
async def step_one(message: str) -> str:
return f"Processed: {message}"
@step
async def step_two(input: str) -> str:
return f"Final: {input}"2. Register and Run
main.py
from contd import Client
# Initialize with your API key
client = Client(api_key="ctd_your_api_key_here")
# Register the workflow
client.register(my_first_workflow)
# Trigger the workflow
run = await client.trigger("my_first_workflow", {
"message": "Hello, Contd!"
})
print(f"Workflow started: {run.id}")
print(f"Status: {run.status}")3. Monitor Execution
monitor.py
# Check status programmatically
status = await client.get_run_status(run.id)
print(f"Status: {status.status}")
print(f"Steps completed: {len(status.completed_steps)}")
# Or use the CLI
# contd workflow status <run_id>What Happens on Failure?
If your workflow crashes mid-execution (server restart, API timeout, etc.), Contd.ai automatically:
- 1Detects the failure and marks the run as "interrupted"
- 2Identifies the last successfully completed checkpoint
- 3Resumes execution from that exact point
- 4Continues with a fresh LLM context (no Context Rot!)