Claude Code
Agents increasingly run as Claude Code sessions. One command wires Claude Code's hooks to Agent Ping: every session becomes a run, every tool use becomes a step, and the run finishes when the session does.
This page covers reporting. To go the other way and ask Claude Code about
your agents (which run failed, what an evaluation said, what a workflow
cost), connect the MCP server instead:
claude mcp add -s user --transport http agentping https://agentping.io/mcp.
The two work together: hooks report the session, MCP lets the session
investigate.
Setup
export AGENTPING_API_KEY=apk_eu_... # team API key
npx agentping-claude-code init
init merges Agent Ping 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 | Agent Ping |
|---|---|
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 Agent Ping is unreachable, your session runs exactly as if the hooks were not installed.