Instrumentation Quickstart
This quickstart guide walks you through instrumenting your first AI agent with Cascade’s observability platform. You’ll set up automatic tracing for an Anthropic Claude agent and view detailed execution data in the Cascade Dashboard, including prompts, completions, token usage, costs, and latency metrics.Get your model provider API key
Obtain an API key from your preferred model provider. Examples:- Anthropic: console.anthropic.com
- OpenAI: platform.openai.com
- Azure OpenAI: Azure Portal
Get your Cascade API key
Go to the Cascade Dashboard to access your project.- Enter the API key we provided to you (format:
cascade_xxx_xxx) - Your traces will be automatically isolated to your project
Contact us to get your Cascade API key. Each key is mapped to your specific project for secure multi-tenant isolation.
Set up your environment
Create a.env file in your project directory to store your API keys securely.
.env
Install Cascade SDK
Install the required packages using pip.Instrument your first traced agent
Create a file calledmy_agent.py with the following code.
my_agent.py
wrap_llm_client() function automatically captures all LLM interactions with zero additional code changes.
Run your agent
Execute your agent script from the terminal.View your trace in the dashboard
Open the Cascade Dashboard to analyze your agent’s execution.- Enter your Cascade API key if prompted
- Find your trace in the list with the name SimpleAgent
- Click on the trace to view detailed information
What gets tracked automatically
When you wrap your LLM client withwrap_llm_client(), Cascade automatically captures comprehensive telemetry without requiring additional instrumentation:
- Full prompts: Complete user messages and system prompts
- Completions: Full responses from the LLM
- Token usage: Input tokens, output tokens, and total tokens
- Cost estimation: Calculated based on current model pricing
- Latency: Response time in milliseconds
- Metadata: Model name, provider, and parameters
- Errors: Exception details and stack traces if failures occur