Samples (70+ runnable)
Stratix Python SDK samples — categorized index of the runnable samples that ship with the SDK.
The LayerLens Python SDK ships with 70+ runnable samples covering every public resource — from a single trace evaluation to multi-agent evaluation patterns and CI/CD quality gates. All samples live in stratix-python/samples/ and run directly after installing the SDK.
Quick start
pip install layerlens --extra-index-url https://sdk.layerlens.ai/package
export LAYERLENS_STRATIX_API_KEY=your-api-key
python samples/core/quickstart.pyquickstart.py walks through the complete workflow end-to-end: upload a trace, create a judge, run an evaluation, and retrieve results.
Samples by category
Each category groups samples around a specific Stratix capability or integration surface. Pick the category closest to what you're building.
Every public resource — traces, judges, evaluations, results, models, benchmarks — used individually and together, including async patterns and pagination
18
Domain-specific evaluation scenarios with judges tuned for regulated and high-stakes verticals (healthcare, financial services, legal, government, insurance, retail)
10
Patterns for evaluating multi-agent collaboration where each agent's output needs independent quality assessment
5
Specialized judges applied to different content types — text responses, brand assets, structured documents
3
Quality gates that embed evaluation into build and deployment pipelines so regressions never reach production
2 + workflow
Trace and evaluate outputs from OpenAI and Anthropic — both manual trace upload and auto-instrumentation paths
4
Trace, evaluate, and monitor OpenClaw autonomous AI agents — cage-match tournaments, code gating, drift detection, content auditing
10 + skill
Expose Stratix capabilities as tools for Claude, Cursor, and any MCP-compatible AI assistant
1
Full-stack pattern with LangGraph CoAgents + generative-UI cards for human-in-the-loop evaluation workflows
2 agents + UI
Pre-built trace files and 16 industry-specific evaluation datasets so every sample runs without sourcing your own data
n/a
Core SDK operations
Located in samples/core/. Start here to learn how every public Stratix resource works, individually and combined.
Key samples:
quickstart.py— first evaluation in under 30 linestrace_evaluation.py— full trace-evaluation lifecyclejudge_optimization.py— optimize a judge via automated prompt evolution (GEPA)evaluation_pipeline.py— chain judges, traces, and results into an automated pipelineasync_workflow.py— concurrent operations withAsyncStratix
See the Core SDK README. Maps to gitbook: Tutorials · Concept: Evaluations.
Industry solutions
Located in samples/industry/. Domain-specific scenarios with judges and scoring configurations tuned for regulated and high-stakes verticals.
Key samples:
healthcare_clinical.py— clinical decision support evaluationfinancial_trading.py— SOX-aligned trading compliancelegal_contracts.py— contract review quality assessment
See the Industry Solutions README. Maps to gitbook: Industry patterns.
Multi-agent evaluation
Located in samples/cowork/. Patterns for evaluating multi-agent collaboration — applicable to any framework where multiple agents produce intermediate outputs that need independent quality assessment.
Key samples:
multi_agent_eval.py— Generator-Evaluator patterncode_review.py— Instrumentor-Reviewer patternrag_assessment.py— RAG-quality evaluation
See the Multi-Agent README. Maps to gitbook: Concept: Agentic evaluation.
Content-type evaluations
Located in samples/modalities/. Specialized judges applied to different content types.
text_evaluation.py— score text across safety, relevance, and compliancebrand_evaluation.py— enforce brand-voice consistencydocument_evaluation.py— validate document-extraction accuracy
CI/CD integration
Located in samples/cicd/. Embed evaluation quality gates into build and deployment pipelines.
quality_gate.py— gate deployments on evaluation pass ratespre_commit_hook.py— catch regressions at commit timegithub_actions_gate.yml— drop-in GitHub Actions workflow
See the CI/CD README. Maps to gitbook: Tutorial 3: CI/CD gates · Cookbook: containerized CI.
LLM provider integrations
Located in samples/integrations/. Two paths: manual trace upload for full control, and auto-instrumentation via layerlens.instrument for zero-code observability.
openai_traced.py— manual trace upload around an OpenAI completionanthropic_traced.py— capture multi-turn Claude conversations (manual trace upload)openai_instrumented.py— auto-instrument OpenAI withinstrument_openai(),@trace,span()langchain_instrumented.py— auto-capture LangChain chain execution withLangChainCallbackHandler
Maps to gitbook: Integrations.
OpenClaw agent evaluation
Located in samples/openclaw/. Trace, evaluate, and monitor OpenClaw autonomous AI agents — including cage-match model tournaments, code gating, drift detection, content auditing, honeypot-skill auditing, and adversarial red-teaming.
See the OpenClaw README for the full list and advanced evaluation patterns.
MCP server
Located in samples/mcp/. Expose Stratix capabilities as tools for Claude, Cursor, and any MCP-compatible AI assistant.
layerlens_server.py— MCP server exposing trace management, judge creation, and evaluation execution
See the MCP README for setup.
CopilotKit integration
Located in samples/copilotkit/. Full-stack pattern combining LangGraph CoAgents (Python) with generative-UI card components (React) for human-in-the-loop evaluation workflows.
agents/evaluator_agent.py— LangGraph CoAgent for evaluation workflows (usesinterrupt()for human-in-the-loop judge confirmation)agents/investigator_agent.py— LangGraph CoAgent for trace investigationcomponents/*.tsx— React card components for rendering results (EvaluationCard,JudgeVerdictCard,TraceCard,MetricCard,ComplianceCard)hooks/*.ts— CopilotKit hooks for wiring Stratix actions (useLayerLensActions,useLayerLensContext)
Checkpointer note: any LangGraph CoAgent that calls
interrupt()(such asevaluator_agent.py) must be compiled with a checkpointer. Without one, the AG-UI stream ends without emittingRUN_FINISHEDand CopilotKit blocks all subsequent messages. The sample ships withInMemorySaverfor a zero-setup local run; the README documents Postgres / SQLite / Redis / LangGraph Platform alternatives for production.
See the CopilotKit README for setup, full file list, and the human-in-the-loop walkthrough.
Claude Code skills
Located in samples/claude-code/. Slash commands that bring Stratix workflows directly into the Claude Code CLI — manage traces, judges, evaluations, optimizations, benchmarks, and investigations without leaving your terminal.
/trace, /judge, /evaluate, /optimize, /benchmark, /investigate. See the Claude Code Skills README.
Sample data
Located in samples/data/. Pre-built trace files, test datasets, and 16 industry-specific evaluation datasets so every sample runs without you sourcing your own data first.
See the Sample Data README for contents.
Full sample reference
For the complete table of every sample with descriptions, see the samples README in the SDK repo.
Where to next
SDK README — full resource list
Cookbook — recipes drawn from these samples
Integrations — full adapter list
Tutorials — guided walkthroughs anchored to these samples
Last updated
Was this helpful?