FastAPI and Python error tracking your coding agent can read

The Runheed Python SDK reports exceptions with the traceback and breadcrumbs. For FastAPI, one middleware records the request and every exception that escapes a route. Your agent reads them over MCP from Claude Code, Cursor or any MCP client.

Set it up

  1. 1.Install the SDK.

    terminalbash
    pip install https://runheed.com/dl/runheed-0.1.0-py3-none-any.whl
  2. 2.Initialize it and add the middleware.

    main.pypython
    import os
    import runheed
    from fastapi import FastAPI
    from runheed import FastAPIIntegration
    
    runheed.init(dsn=os.environ["RUNHEED_DSN"], environment="production")
    
    app = FastAPI()
    integration = FastAPIIntegration()
    integration.setup(runheed.get_client())
    app.add_middleware(integration.create_middleware())
  3. 3.Connect your agent.

    terminalbash
    claude mcp add runheed -e RUNHEED_API_KEY=al_... -- npx -y https://runheed.com/dl/runheed-mcp-0.1.0.tgz

The npm and PyPI releases are not out yet, so these commands install the same package files straight from runheed.com. Nothing else changes when the registry versions ship.

What it catches

  • Exceptions raised in route handlers, with method and URL
  • Errors logged through the logging module (on by default)
  • Errors you report with runheed.capture_exception(e)

What it does not do

  • Background tasks and workers need capture_exception in their own except blocks
  • No performance tracing: Runheed tracks errors only

Then ask your agent

> what broke in production since the last deploy? fix the top one and resolve it with the commit hash

Common Python and FastAPI errors