Who it is forA developer debugging slow or odd behaviour in a script.
The problemPlain print statements lose structure and timing.
The outcomeStructured logs and a timed span for the block you wrapped.
What you need first
- Python with pip
- A Logfire account, since the backend is a closed source hosted service
- uv for the uvx commands
Steps
- Install with
pip install logfire - Add import Logfire and call Logfire.configure()
- Log with Logfire.info('Hello, {name}!', name='world')
- Wrap work in with Logfire.span('Asking the user their {question}', question='age'): and log inside it with Logfire.debug
Prompt for your agent
With pydantic/logfire, add logfire.configure(), a logfire.info call and a logfire.span around the main function of <my script>, then explain what each field in the output means.
Caveat. You need a connected Logfire project to view the results.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for pydantic/logfire and "Trace a script with spans and structured logs"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer