Long Running Sessions Integration

Monitor long-running AI sessions in real-time — track progress, events, and status across Claude Code and other tools.

Long-running sessions enable Neatlogs to monitor and track the progress of AI-powered sessions in real-time. When you dispatch tasks to Claude Code or other code-fixing tools, Neatlogs monitors the session lifecycle, captures key events (PR creation, errors, completion), and provides full observability into what's happening.


Claude Code Session Monitoring

When you use Claude Code via Neatlogs, every session is monitored and tracked. You get real-time visibility into:

  • Session Status — Track whether the session is running, completed, failed, or cancelled
  • PR & Branch Info — See which PR was created and on which branch
  • Duration & Timing — Measure how long the session took from start to finish
  • Error Tracking — Capture and display any errors that occurred during the session
  • Event Stream — Access the full sequence of session events for debugging

Setting Up Claude Code Session Monitoring

Step 1: Create a Claude Code Routine

  1. Visit claude.ai/code/routines
  2. Create a new routine and link it to your GitHub account
  3. Anthropic will provide:
    • A routine URL
    • A one-shot bearer token
    • Your Anthropic API key (if you don't have one)

Step 2: Connect to Neatlogs

  1. Go to Settings → Integrations → Claude Code
  2. Select "Routines" auth method
  3. Paste:
    • Anthropic API key
    • Routine URL
    • Routine bearer token
  4. Save

Once connected, Neatlogs can dispatch tasks to Claude Code and monitor the resulting sessions.

View Your Claude Code Sessions

Sessions are tracked and stored in Neatlogs. You can:

  1. View session status in the Task Details after dispatching
  2. See real-time updates as the session progresses
  3. Access the PR link once it's created
  4. Monitor session duration and completion time
  5. Review any errors in the error message field

Each session includes:

  • Status: running, finished, error, or cancelled
  • PR URL: Direct link to the pull request
  • Branch: The branch where changes were made
  • Duration: Elapsed time from start to finish
  • Created/Finished times: Exact timestamps
  • Events: Full event log from Claude Code

Monitor Session Progress in Real-Time

Neatlogs continuously polls Claude Code's session API to:

  1. Capture session state changes
  2. Track when PRs are opened
  3. Record session completion or errors
  4. Measure total duration

The full event stream is available for analysis — no data is lost. You can see:

  • Session started
  • Tool calls made
  • PR opened
  • Branch name
  • Session completed or failed
  • Any error messages

This gives you complete visibility into what Claude Code was doing.

Session Data Captured

DataDescription
Session IDUnique identifier from Claude Code
Statusrunning, finished, error, cancelled
PR URLLink to the created pull request
BranchGit branch where changes were made
Duration (ms)Time from session start to completion
Created AtSession start timestamp (ISO 8601)
Finished AtSession end timestamp (ISO 8601)
Error MessageDetails if the session failed
EventsFull stream of session events

Session Lifecycle Events

Neatlogs tracks these key events during a Claude Code session:

Standard Session Events:

  • session_started — Session began execution
  • pr_opened — Pull request was created
  • session_completed — Session finished successfully
  • session_failed — Session encountered an error
  • session_cancelled — Session was manually stopped

Each event includes timing information (created_at) and relevant metadata (PR URL, branch name, error message).

Error Tracking:

If a session fails, Neatlogs captures:

  • The error message from Claude Code
  • The timestamp when the error occurred
  • Session status set to error

Common errors:

  • GitHub authentication failures
  • Repository access issues
  • Branch conflicts
  • API rate limits

Check the error message field in the session details for troubleshooting.

Completion States:

Sessions can end in four states:

  1. finished — Session completed successfully (PR created, changes made)
  2. error — Session failed (error message included)
  3. cancelled — Session was manually stopped
  4. running — Session is still in progress (if monitoring was interrupted)

The finishedAt timestamp marks when the session ended.

Accessing Session Data

Sessions are stored in Neatlogs and accessible via:

  1. Task Details Page — View session status when you dispatch
  2. Session History — See all past sessions for a task
  3. API — Query session data programmatically
  4. Analytics — Track session success rates and duration trends

On this page

Ask Neatlogs AI

Answers from the docs

How can I help?

Ask anything about instrumenting, tracing, or the Neatlogs dashboard.