Skip to content

Conversation

@nikhilwoodruff
Copy link
Contributor

Adds proper observability with trace context propagation so all spans from a single request appear together in Logfire, regardless of whether they run in FastAPI or Modal.

Changes:

  • Add logfire to Modal base images and agent sandbox
  • Configure logfire with service names (policyengine-modal-uk/us, policyengine-agent)
  • Pass W3C traceparent from FastAPI to Modal spawn calls
  • Agent sandbox passes traceparent in HTTP requests back to API
  • Replace rich.console logging with logfire spans in all Modal functions

Testing: Trigger a household calculation or agent question, then check Logfire for unified traces across policyengine-api, policyengine-modal-uk/us, and policyengine-agent services.

Adds proper observability with trace context propagation so all spans from a single request appear together in Logfire, regardless of whether they run in FastAPI or Modal.

Changes:
- Add logfire to Modal base images and agent sandbox
- Configure logfire with service names (policyengine-modal-uk/us, policyengine-agent)
- Pass W3C traceparent from FastAPI to Modal spawn calls
- Agent sandbox passes traceparent in HTTP requests back to API
- Replace rich.console logging with logfire spans in all Modal functions
@nikhilwoodruff nikhilwoodruff merged commit e8c3d33 into main Dec 30, 2025
1 check passed
@nikhilwoodruff nikhilwoodruff deleted the unified-logfire-tracing branch December 30, 2025 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants