Quick Start
How It Works
| Event Type | Extraction Class | Grounded | Description |
|---|---|---|---|
AGENT_START | agent_run | First 200 chars of input | Agent run initiation |
TOOL_START | tool_call | No (ungrounded) | Tool execution start |
TOOL_END | tool_result | No | Tool execution result |
OUTPUT | final_output | First 1000 chars of output | Agent final output |
ERROR | error | No | Error events |
Configuration Options
TheLangextractSinkConfig class provides comprehensive configuration:
| Option | Type | Default | Description |
|---|---|---|---|
output_path | str | "praisonai-trace.html" | HTML file written on close() |
jsonl_path | Optional[str] | None | Annotated-documents JSONL path (derived from output_path if None) |
document_id | str | "praisonai-run" | Document ID in the JSONL |
auto_open | bool | False | Open the HTML in a browser after render |
include_llm_content | bool | True | Include response text in attributes |
include_tool_args | bool | True | Include tool args in attributes |
enabled | bool | True | Master switch |
CLI Reference
render command
Render a YAML workflow with langextract observability:-o, --output FILE: Output HTML file path (default:workflow.html)--no-open: Don’t open HTML in browser automatically--api-url URL: API URL if using remote API
view command
Render an existing annotated-documents JSONL to HTML:-o, --output FILE: Output HTML file path (default:trace.html)--no-open: Don’t open HTML in browser automatically
—observe flag
Instrument any PraisonAI command with langextract:Common Patterns
- Single Agent with Custom Config
- CLI Workflow
- Post-hoc Analysis
Troubleshooting
"Trace was not rendered" / empty HTML
"Trace was not rendered" / empty HTML
Ensure you call
sink.close() to trigger the rendering process. The CLI commands handle this automatically, but programmatic usage requires explicit closure.ImportError: langextract not found
ImportError: langextract not found
Install langextract with the PraisonAI extra:This installs both PraisonAI and the required langextract dependency.
Empty trace output
Empty trace output
Verify that your agent actually emits trace events. Single agents require proper trace emitter setup as shown in the examples above.
Browser doesn't open automatically
Browser doesn't open automatically
Check the For CLI commands, remove the
auto_open configuration:--no-open flag.Best Practices
Use auto_open=False in CI/CD
Use auto_open=False in CI/CD
Disable automatic browser opening in automated environments:
Scope the emitter properly
Scope the emitter properly
Restore the previous emitter after your run to avoid affecting other code:
Use descriptive document IDs
Use descriptive document IDs
Set meaningful document IDs for easier trace identification:
Handle rendering failures gracefully
Handle rendering failures gracefully
Langextract rendering failures don’t break agent execution - check logs for details:
Related
Observability Overview
Compare all observability providers
Langfuse Integration
Hosted observability alternative

