Skip to main content
These examples are designed to be copied into your own repo. Each one is intentionally small, so you can validate end‑to‑end quickly and then scale it up.

Example 1: Minimal manual tracing

Use this when you’re not running LangGraph or CrewAI yet.
import omium

omium.init()

@omium.trace("extract")
def extract(text: str) -> dict:
    return {"length": len(text)}

@omium.checkpoint("after_extract")
def next_step(state: dict) -> dict:
    return {"ok": True, **state}

if __name__ == "__main__":
    state = extract("hello")
    print(next_step(state))

Example 2: LangGraph “instrument once”

import omium
from langgraph.graph import StateGraph

omium.init()
omium.instrument_langgraph()

graph = StateGraph(dict)
# … add nodes and edges …
app = graph.compile()

result = app.invoke({"input": "Hello"})
print(result)
See the integration guide: LangGraph.

Example 3: CrewAI “instrument once”

import omium
from crewai import Crew, Agent, Task

omium.init()
omium.instrument_crewai()

agent = Agent(role="Researcher", goal="Summarize", backstory="You write concise summaries.")
task = Task(description="Summarize: Hello world", agent=agent)

crew = Crew(agents=[agent], tasks=[task])
print(crew.kickoff())
See the integration guide: CrewAI.

Example 4: Environment-first configuration (CI pattern)

In CI/CD, prefer environment variables over local config files.
export OMIUM_API_KEY=omium_your_key_here
export OMIUM_API_URL=https://api.omium.ai
python your_script.py
See Environment variables.

Example 5: Drive recovery via HTTP (replay)

If you operate Omium from a non-Python control plane, you can replay a failed run from a checkpoint:
curl -sS "https://api.omium.ai/api/v1/executions/exec_abc/replay" \
  -H "X-API-Key: $OMIUM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "checkpoint_id": "chk_1" }'
See Executions and Checkpoints.

Next steps

Quickstart

Run a traced workflow locally.

Python SDK

Auto-instrument or trace manually.

Release notes

Follow product and doc changes.

API overview

Base URL, auth, and links to every resource.