A small, copy-paste friendly reference for running an Idun Agent Engine LangGraph workflow where every LLM call goes through LightReach’s hosted Compress API (routing + optional prompt compression + cost metadata).
This demo intentionally does not run Compress locally. Compress is a cloud service.
- Idun can serve a LangGraph agent over HTTP (
/agent/run, OpenAPI docs at/docs). - The agent can call Compress using your LightReach API key (
lr_…) and your BYOK provider keys configured in the LightReach dashboard. - You can keep responsibilities cleanly separated:
- Idun: agent API/runtime + graph orchestration
- Compress: cross-provider routing, compression, and cost attribution
This is intentionally aligned with how Idun Platform positions production agents: a stable HTTP API, LangGraph orchestration, and durable conversation state (this demo uses SQLite checkpoints in config.yaml; swap for Postgres when you harden).
The graph implements a small internal on-call copilot: if the user does not supply a system message, the agent prepends a triage-focused system prompt (concise bullets, no invented logs, mitigation-first). That is the kind of behavior product and platform teams wrap behind an API — not a toy “hello world.”
Downstream, LightReach Compress is a better fit than hand-rolling provider clients: same request can be routed across your BYOK universe under an HLE floor, with optional input compression (helpful when on-call pastes repeat boilerplate), and tags for attribution (COMPRESS_TAG_*).
With POST /api/v2/complete, the demo can append a short metadata footer (model, provider, rough cost, compression token delta) so stakeholders see routing transparency without spelunking logs. Turn it off with COMPRESS_APPEND_META_FOOTER=false.
User/App
-> Idun Agent Engine (LangGraph workflow)
-> LightReach Compress API
-> Routed upstream provider model (OpenAI/Anthropic/Google/…)
- A LightReach account and API key (
lr_…) - At least one upstream provider key added in the LightReach dashboard (BYOK)
Docs:
- Sign up: compress.lightreach.io/signup
- Native completion endpoint used by default in this demo:
POST /api/v2/complete
- Create your env file:
cd examples/idun_compress_agent
cp stack.env.example stack.env- Set your LightReach key in
stack.env:
COMPRESS_API_KEY=lr_…- Start Idun Agent Engine:
docker compose --env-file stack.env up --build- Verify Idun is up:
curl -fsS http://localhost:8800/health
curl -fsS http://localhost:8800/docs >/dev/null && echo "OK: /docs"- Run a request through Idun → Compress (realistic on-call paste — verbose prompts compress well):
curl -sS -X POST http://localhost:8800/agent/run \
-H "Content-Type: application/json" \
-d '{
"thread_id": "demo-inc-1",
"messages": [
{
"id": "msg-1",
"role": "user",
"content": "SEV-2 | checkout API\nWindow: last 20m\nSymptoms: elevated 5xx from payments-api, p95 latency ~4s vs ~400ms baseline. Partial overlap with last week after a config rollout (INC-1891).\nTried: pod restart (no lasting effect), scale 6→10 replicas (partial relief).\nAsk: first mitigation checks in order, and whether we should roll back feature flag payments.dual-write.enabled (enabled ~2h ago)."
}
]
}'Helper scripts:
bash scripts/smoke_test.sh
bash scripts/demo_request.shDefaults are chosen to match the public docs:
- Default mode:
POST /api/v2/completeviaCOMPRESS_V2_URL - Optional mode: OpenAI-compatible
POST /chat/completionsviaCOMPRESS_OPENAI_BASE_URL(setCOMPRESS_USE_OPENAI_COMPAT=1)
Common knobs (see stack.env.example):
COMPRESS_API_KEY(required)COMPRESS_V2_URL(defaults tohttps://compress.lightreach.io/api/v2/complete)COMPRESS_DESIRED_HLE(defaults to25)COMPRESS_COMPRESS(defaults totrue)COMPRESS_LLM_PROVIDER(optional provider constraint)COMPRESS_TAG_*(optional attribution tags)AGENT_SYSTEM_PROMPT(optional; overrides the built-in triage system prompt)COMPRESS_APPEND_META_FOOTER(defaulttruefor v2 demos; appends routing/cost/compression lines)
agent.py- LangGraph workflow (triage system prompt + Compress call + optional v2 metadata footer)config.yaml- Idun file-based engine configdocker-compose.yml- Idun-only Docker stackstack.env.example- environment templateDockerfile- Idun agent imagedocker_entrypoint.sh- starts Idun engine on0.0.0.0scripts/smoke_test.sh- health and docs checksscripts/demo_request.sh- sends a sample request to/agent/run
The container will start, but model calls will fail until you set a real lr_… key in stack.env.
Compress routes using the provider keys you configured in the LightReach dashboard. If no usable provider key exists for the selected route, requests fail upstream.
Idun’s CLI defaults to binding localhost inside containers. This demo starts the engine with host=0.0.0.0 from docker_entrypoint.sh.
If needed:
docker compose --env-file stack.env build --no-cache idun-agent
docker compose --env-file stack.env upThis demo only runs Idun Agent Engine on 8800. If you also run the full Idun platform stack, avoid double-booking ports on your machine.
This demo uses Idun Agent Engine only. If you want the full Idun Manager/Web UI:
git clone https://github.com/Idun-Group/idun-agent-platform.git
cd idun-agent-platform
cp .env.example .env
docker compose -f docker-compose.dev.yml up --buildThen enroll your agent and point graph_definition to:
./examples/idun_compress_agent/agent.py:workflow
Use this short description in your repo:
"A runnable reference showing how to deploy an Idun-managed LangGraph agent that sends LLM inference traffic through LightReach’s hosted Compress API for routing, optional compression, and cost attribution."