List events
Returns a graph’s events, newest first by default, from its retained history.
Following a graph. Remember the newest event id you’ve seen, and list with order=asc and starting_after set to it: you get only what’s happened since, each event with its changes. No need to fetch the graph again. If you fall so far behind that the event is no longer retained, that’s 410 outside_retention_window, and the error’s first_event_id is the oldest event still held: fetch the graph again, and follow on from there.
Replaying history. List with order=asc from the start of retention, or from any event; expand[]=data.node adds each event’s node as it stood just after it.
Query Parameters
A cursor: an object id from the list. Returns the page before it. Pass the first id of the page you have to get the previous one.
Fields to expand on each event: expand[]=data.node (the node just after the event), and its own fields, data.node.parent.
Send one expand[] per path. A path goes at most 4 levels deep; at most 20 paths per request. An expanded field appears beside its _id field, which is always there; one not expanded is absent.
List events
curl https://agentgraph.chofter.com/api/v1/graphs/$GRAPH_ID/events \
-H "Authorization: Bearer $AGENT_GRAPH_API_KEY"{
"object": "list",
"url": "/api/v1/graphs/gph_k3P9xQ2mWt7a/events",
"as_of_event_id": "evt_01M4G3G4E8Q9R2M5X4T6W8Y0B1",
"has_more": true,
"data": [
{
"id": "evt_01M4G3G0E4H6TW2C9Z5RB1KQ0E",
"object": "event",
"type": "status",
"created": 1791541903812,
"graph_id": "gph_k3P9xQ2mWt7a",
"node_id": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEwL2EzZmQwN2MyYjE5ZTRkNjE",
"source": {
"provider": "claude-code",
"provider_version": "2.1.260",
"adapter": "claude-code@1"
},
"payload": {
"state": "working",
"summary": "Reading the auth middleware"
},
"changes": [
{
"node_id": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEwL2EzZmQwN2MyYjE5ZTRkNjE",
"created": false,
"fields": {
"summary": {
"from": null,
"to": "Reading the auth middleware"
},
"headline": {
"from": "Searching for callers",
"to": "Reading the auth middleware"
}
}
}
]
},
{
"id": "evt_01M4G2FMPN7KD3N1PZ0QX8RM4A",
"object": "event",
"type": "agent.spawned",
"created": 1791540843221,
"graph_id": "gph_k3P9xQ2mWt7a",
"node_id": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEwL2EzZmQwN2MyYjE5ZTRkNjE",
"source": {
"provider": "claude-code",
"provider_version": "2.1.260",
"adapter": "claude-code@1"
},
"payload": {
"agent_type": "Explore",
"purpose": "Find every caller of the old session store"
},
"changes": [
{
"node_id": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEwL2EzZmQwN2MyYjE5ZTRkNjE",
"created": true,
"fields": {
"state": {
"from": null,
"to": "working"
},
"parent_id": {
"from": null,
"to": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEw"
}
}
},
{
"node_id": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEw",
"created": false,
"fields": {
"child_count": {
"from": 2,
"to": 3
},
"descendant_count": {
"from": 4,
"to": 5
},
"blocked": {
"from": null,
"to": {
"on_ids": [
"node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEwL2EzZmQwN2MyYjE5ZTRkNjE"
],
"starting": 0,
"node_count": 1,
"open_tasks": 0,
"cycle": false
}
}
}
}
]
}
]
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "Invalid limit: must be between 1 and 1000.",
"param": "limit",
"doc_url": "https://agentgraph.chofter.com/docs/reference#errors"
}
}{
"error": {
"type": "invalid_request_error",
"code": "expand_too_deep",
"message": "The path children.children.children.children.children goes 5 levels deep; at most 4 are allowed.",
"param": "expand",
"doc_url": "https://agentgraph.chofter.com/docs/reference#errors"
}
}{
"error": {
"type": "authentication_error",
"code": "api_key_invalid",
"message": "Invalid API key: ag_sk_live_****Xa9T.",
"param": null,
"doc_url": "https://agentgraph.chofter.com/docs/reference#errors"
}
}{
"error": {
"type": "permission_error",
"code": "api_key_restricted",
"message": "This restricted key can't read gph_k3P9xQ2mWt7a.",
"param": null,
"doc_url": "https://agentgraph.chofter.com/docs/reference#errors"
}
}{
"error": {
"type": "invalid_request_error",
"code": "resource_missing",
"message": "No such node: node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEwL2I4MWMyMmUwOWY3YTNjNTU.",
"param": "node_id",
"doc_url": "https://agentgraph.chofter.com/docs/reference#errors"
}
}{
"error": {
"type": "invalid_request_error",
"code": "node_not_yet_created",
"message": "The node node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEwL2EzZmQwN2MyYjE5ZTRkNjE is created by evt_01M4G2FMPN7KD3N1PZ0QX8RM4A, after as_of.",
"param": "as_of",
"doc_url": "https://agentgraph.chofter.com/docs/reference#errors",
"first_event_id": "evt_01M4G2FMPN7KD3N1PZ0QX8RM4A"
}
}{
"error": {
"type": "invalid_request_error",
"code": "outside_retention_window",
"message": "This graph holds events from evt_01M4FXYWR82B8XK0V5QJ7M1N3R to evt_01M4G3G4E8Q9R2M5X4T6W8Y0B1.",
"param": "as_of",
"doc_url": "https://agentgraph.chofter.com/docs/reference#errors",
"first_event_id": "evt_01M4FXYWR82B8XK0V5QJ7M1N3R",
"last_event_id": "evt_01M4G3G4E8Q9R2M5X4T6W8Y0B1"
}
}{
"error": {
"type": "rate_limit_error",
"code": "rate_limit",
"message": "Too many requests. Try again in 1 second.",
"param": null,
"doc_url": "https://agentgraph.chofter.com/docs/reference#errors"
}
}{
"error": {
"type": "api_error",
"code": "api_error",
"message": "Something went wrong. Try again, and include the Request-Id if it keeps happening.",
"param": null,
"doc_url": "https://agentgraph.chofter.com/docs/reference#errors"
}
}Returns Examples
{
"object": "list",
"url": "/api/v1/graphs/gph_k3P9xQ2mWt7a/events",
"as_of_event_id": "evt_01M4G3G4E8Q9R2M5X4T6W8Y0B1",
"has_more": true,
"data": [
{
"id": "evt_01M4G3G0E4H6TW2C9Z5RB1KQ0E",
"object": "event",
"type": "status",
"created": 1791541903812,
"graph_id": "gph_k3P9xQ2mWt7a",
"node_id": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEwL2EzZmQwN2MyYjE5ZTRkNjE",
"source": {
"provider": "claude-code",
"provider_version": "2.1.260",
"adapter": "claude-code@1"
},
"payload": {
"state": "working",
"summary": "Reading the auth middleware"
},
"changes": [
{
"node_id": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEwL2EzZmQwN2MyYjE5ZTRkNjE",
"created": false,
"fields": {
"summary": {
"from": null,
"to": "Reading the auth middleware"
},
"headline": {
"from": "Searching for callers",
"to": "Reading the auth middleware"
}
}
}
]
},
{
"id": "evt_01M4G2FMPN7KD3N1PZ0QX8RM4A",
"object": "event",
"type": "agent.spawned",
"created": 1791540843221,
"graph_id": "gph_k3P9xQ2mWt7a",
"node_id": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEwL2EzZmQwN2MyYjE5ZTRkNjE",
"source": {
"provider": "claude-code",
"provider_version": "2.1.260",
"adapter": "claude-code@1"
},
"payload": {
"agent_type": "Explore",
"purpose": "Find every caller of the old session store"
},
"changes": [
{
"node_id": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEwL2EzZmQwN2MyYjE5ZTRkNjE",
"created": true,
"fields": {
"state": {
"from": null,
"to": "working"
},
"parent_id": {
"from": null,
"to": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEw"
}
}
},
{
"node_id": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEw",
"created": false,
"fields": {
"child_count": {
"from": 2,
"to": 3
},
"descendant_count": {
"from": 4,
"to": 5
},
"blocked": {
"from": null,
"to": {
"on_ids": [
"node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEwL2EzZmQwN2MyYjE5ZTRkNjE"
],
"starting": 0,
"node_count": 1,
"open_tasks": 0,
"cycle": false
}
}
}
}
]
}
]
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "Invalid limit: must be between 1 and 1000.",
"param": "limit",
"doc_url": "https://agentgraph.chofter.com/docs/reference#errors"
}
}{
"error": {
"type": "invalid_request_error",
"code": "expand_too_deep",
"message": "The path children.children.children.children.children goes 5 levels deep; at most 4 are allowed.",
"param": "expand",
"doc_url": "https://agentgraph.chofter.com/docs/reference#errors"
}
}{
"error": {
"type": "authentication_error",
"code": "api_key_invalid",
"message": "Invalid API key: ag_sk_live_****Xa9T.",
"param": null,
"doc_url": "https://agentgraph.chofter.com/docs/reference#errors"
}
}{
"error": {
"type": "permission_error",
"code": "api_key_restricted",
"message": "This restricted key can't read gph_k3P9xQ2mWt7a.",
"param": null,
"doc_url": "https://agentgraph.chofter.com/docs/reference#errors"
}
}{
"error": {
"type": "invalid_request_error",
"code": "resource_missing",
"message": "No such node: node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEwL2I4MWMyMmUwOWY3YTNjNTU.",
"param": "node_id",
"doc_url": "https://agentgraph.chofter.com/docs/reference#errors"
}
}{
"error": {
"type": "invalid_request_error",
"code": "node_not_yet_created",
"message": "The node node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEwL2EzZmQwN2MyYjE5ZTRkNjE is created by evt_01M4G2FMPN7KD3N1PZ0QX8RM4A, after as_of.",
"param": "as_of",
"doc_url": "https://agentgraph.chofter.com/docs/reference#errors",
"first_event_id": "evt_01M4G2FMPN7KD3N1PZ0QX8RM4A"
}
}{
"error": {
"type": "invalid_request_error",
"code": "outside_retention_window",
"message": "This graph holds events from evt_01M4FXYWR82B8XK0V5QJ7M1N3R to evt_01M4G3G4E8Q9R2M5X4T6W8Y0B1.",
"param": "as_of",
"doc_url": "https://agentgraph.chofter.com/docs/reference#errors",
"first_event_id": "evt_01M4FXYWR82B8XK0V5QJ7M1N3R",
"last_event_id": "evt_01M4G3G4E8Q9R2M5X4T6W8Y0B1"
}
}{
"error": {
"type": "rate_limit_error",
"code": "rate_limit",
"message": "Too many requests. Try again in 1 second.",
"param": null,
"doc_url": "https://agentgraph.chofter.com/docs/reference#errors"
}
}{
"error": {
"type": "api_error",
"code": "api_error",
"message": "Something went wrong. Try again, and include the Request-Id if it keeps happening.",
"param": null,
"doc_url": "https://agentgraph.chofter.com/docs/reference#errors"
}
}