query_subgraph
Extract a self-contained local subgraph around seed IDs from a session's Knowledge Structure, with filters and budget caps for targeted exploration.
Instructions
Extract the local k‑hop neighbourhood around one or more seed ids from a session's current Knowledge Structure. Returns a self‑contained subgraph (serialized) and metadata: total_found_nodes, returned_nodes, is_truncated, truncation_reason, suggested_next_seed. Use filters (include_relation_types, include_object_types) to narrow the traversal, and max_tokens/max_objects to cap the result. type_weights can prioritise certain object types when the budget forces truncation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| depth | No | Maximum hops from any seed. Default 1. | |
| seed_ids | No | List of object ids to start traversal from. | |
| max_tokens | No | Optional token budget (approx). | |
| session_id | Yes | The session whose Knowledge Structure to query. | |
| max_objects | No | Optional hard cap on total objects returned. | |
| compact_mode | No | If true, return a compact representation (nodes + edges) instead of full canonical JSON. | |
| type_weights | No | Optional mapping of object type to weight (float), used in budget ranking. | |
| structure_filters | No | Optional. AND-filter applied to non-relation objects after extraction: only objects whose 'structure' dict contains ALL key=value pairs survive. Seed objects are always kept regardless. Relations are retained when both their participants survive the filter. Example: {"status": "active", "domain": "biology"}. | |
| include_object_types | No | Optional. Only include discovered objects of these types (seeds always kept). | |
| include_relation_types | No | Optional. Only traverse/include these relation types. |