Search nodes
GET/graphs/{graph_id}/nodes/search
Searches a graph’s nodes with a query, as of a point in its history.
Use it for questions the list filters can’t express: text in a node’s summary, OR, negation, numeric comparisons.
Query language
A query is one or more clauses, joined by AND or OR (not both in one query). Values are quoted.
| Clause | Matches |
|---|---|
field:"value" | Exactly equal (case-insensitive for text). |
field~"value" | Contains (text fields; at least 3 characters). |
-field:"value" | Not equal. |
field>value, field>=value, field<value, field<=value | Numbers and times (Unix milliseconds). |
field:null | Has no value. |
Fields: state, kind, provider, agent_type, stale, blocked, background, parent_id, root_id, session_id, depth, created, ended, last_event, child_count, descendant_count, open_tasks (its task_counts.open), blocked_open_tasks (its blocked.open_tasks), title, summary, headline, purpose, attention.
Examples
state:"working" AND stale:"true"
agent_type:"Explore" AND descendant_count>10
state:"failed" OR state:"canceled"
summary~"migration" AND -state:"completed"
blocked_open_tasks>=20
Results are most recently active first.
Query Parameters
Search nodes
curl https://agentgraph.chofter.com/api/v1/graphs/$GRAPH_ID/nodes/search \
-H "Authorization: Bearer $AGENT_GRAPH_API_KEY"{
"object": "search_result",
"url": "/api/v1/graphs/gph_k3P9xQ2mWt7a/nodes/search?query=state%3A%22working%22",
"as_of_event_id": "evt_01M4G3G4E8Q9R2M5X4T6W8Y0B1",
"has_more": false,
"next_page": null,
"total_count": 1,
"data": [
{
"id": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEwL2I4MWMyMmUwOWY3YTNjNTU",
"object": "node",
"as_of_event_id": "evt_01M4G3G4E8Q9R2M5X4T6W8Y0B1",
"graph_id": "gph_k3P9xQ2mWt7a",
"provider_ref": "claude-code:5f2c1e9a-8d1b-4b6e-9a51-0f6f2c7d3e10/b81c22e09f7a3c55",
"provider": "claude-code",
"kind": "agent",
"parent_id": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEwL2EzZmQwN2MyYjE5ZTRkNjE",
"root_id": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEw",
"session_id": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEw",
"requested_by_id": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEwL2EzZmQwN2MyYjE5ZTRkNjE",
"depth": 2,
"state": "working",
"stale": false,
"attention": null,
"title": null,
"summary": null,
"headline": "Searching for SessionStore imports",
"purpose": "List the files that import SessionStore",
"agent_type": "general-purpose",
"background": false,
"link_method": null,
"spawn_call_id": "toolu_01Pq4Ze8sYh2WnVb6XcJ1dRt",
"cwd": "/Users/dev/work/api",
"created": 1791540874033,
"ended": null,
"last_event": 1791541898692,
"child_count": 0,
"descendant_count": 0,
"background_agent_count": 0,
"task_counts": {
"total": 5,
"pending": 3,
"in_progress": 1,
"completed": 1,
"open": 4
},
"blocked": null
}
]
}{
"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": "search_result",
"url": "/api/v1/graphs/gph_k3P9xQ2mWt7a/nodes/search?query=state%3A%22working%22",
"as_of_event_id": "evt_01M4G3G4E8Q9R2M5X4T6W8Y0B1",
"has_more": false,
"next_page": null,
"total_count": 1,
"data": [
{
"id": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEwL2I4MWMyMmUwOWY3YTNjNTU",
"object": "node",
"as_of_event_id": "evt_01M4G3G4E8Q9R2M5X4T6W8Y0B1",
"graph_id": "gph_k3P9xQ2mWt7a",
"provider_ref": "claude-code:5f2c1e9a-8d1b-4b6e-9a51-0f6f2c7d3e10/b81c22e09f7a3c55",
"provider": "claude-code",
"kind": "agent",
"parent_id": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEwL2EzZmQwN2MyYjE5ZTRkNjE",
"root_id": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEw",
"session_id": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEw",
"requested_by_id": "node_Y2xhdWRlLWNvZGU6NWYyYzFlOWEtOGQxYi00YjZlLTlhNTEtMGY2ZjJjN2QzZTEwL2EzZmQwN2MyYjE5ZTRkNjE",
"depth": 2,
"state": "working",
"stale": false,
"attention": null,
"title": null,
"summary": null,
"headline": "Searching for SessionStore imports",
"purpose": "List the files that import SessionStore",
"agent_type": "general-purpose",
"background": false,
"link_method": null,
"spawn_call_id": "toolu_01Pq4Ze8sYh2WnVb6XcJ1dRt",
"cwd": "/Users/dev/work/api",
"created": 1791540874033,
"ended": null,
"last_event": 1791541898692,
"child_count": 0,
"descendant_count": 0,
"background_agent_count": 0,
"task_counts": {
"total": 5,
"pending": 3,
"in_progress": 1,
"completed": 1,
"open": 4
},
"blocked": null
}
]
}{
"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"
}
}