---
title: Claude Code
description: Monitor the agents you run as Claude Code sessions; one init command wires the hooks.
section: integrations
order: 8
---

# Claude Code

Agents increasingly run as Claude Code sessions. One command wires Claude
Code's hooks to AgentPing: every session becomes a run, every tool use
becomes a step, and the run finishes when the session does.

## Setup

```bash
export AGENTPING_API_KEY=apk_eu_...   # team API key
npx agentping-claude-code init
```

`init` merges AgentPing hooks into the project's `.claude/settings.json`
without touching anything already there (pass `--global` for
`~/.claude/settings.json`). Sessions report as runs on the agent named by
`AGENTPING_AGENT` (default `claude-code`).

## What gets reported

| Claude Code hook | AgentPing |
|---|---|
| `SessionStart` | The run starts; the run id derives from the session id, so retries dedupe |
| `UserPromptSubmit` | The first prompt becomes the run's goal, so evaluations know what the session was for |
| `PostToolUse` | One `tool_call` step per tool use, with ok or error status |
| `Stop` / `SessionEnd` | The run finishes |

## Guarantees

Hooks never block or fail the session: every hook command exits 0,
network calls time out after 1.5 seconds, and errors are swallowed after
one stderr warning. If AgentPing is unreachable, your session runs
exactly as if the hooks were not installed.

## Source

[github.com/agent-ping/agentping-claude-code](https://github.com/agent-ping/agentping-claude-code)
