Search, statistics, and NAMS lifecycle
Semantic search over traces/steps, tool-usage statistics, and the NAMS synthetic-trace lifecycle from ReasoningMemory API reference. Signatures show types, keyword-only arguments (*), and defaults; they are reference declarations, not calls to execute directly.
Search (bolt only)
get_similar_traces
Search trace task embeddings. Returns ReasoningTrace models with metadata["similarity"], not score tuples.
async def get_similar_traces(
task: str,
*,
limit: int=5,
success_only: bool=True,
threshold: float=0.7,
) -> list[ReasoningTrace]: ...
| Parameter | Description |
|---|---|
|
Task description to match |
|
Maximum number of results |
|
Only return successful traces |
|
Minimum similarity threshold |
search_steps
Search step embeddings. Returns ReasoningStepWithContext wrappers with step, similarity, and parent task/outcome fields. Step search needs a configured embedder. add_step embeds each step by default; steps recorded with generate_embedding=False, which is the StreamingTraceRecorder default, have no embedding until complete_trace(…, generate_step_embeddings=True) embeds them.
async def search_steps(
query: str,
*,
limit: int=10,
success_only: bool=True,
threshold: float=0.7,
) -> list[ReasoningStepWithContext]: ...
| Parameter | Description |
|---|---|
|
Free-text query. Embedded via the configured embedder. |
|
Maximum number of results. |
|
When |
|
Minimum cosine similarity, 0-1. |
Trace and step semantic searches are global: neither accepts a session filter. There are no search_traces or find_similar_traces methods.
for trace in await client.reasoning.get_similar_traces("restaurant recommendations"):
print(trace.task, trace.metadata.get("similarity"), trace.outcome)
for match in await client.reasoning.search_steps("find a nearby restaurant"):
print(match.similarity, match.step.thought, match.parent_task)
Statistics (bolt only)
get_tool_stats
Return a list of ToolStats models, optionally filtered by tool name. There is no session argument and the result is not a dictionary keyed by tool name.
async def get_tool_stats(tool_name: str | None=None) -> list[ToolStats]: ...
| Parameter | Description |
|---|---|
|
Optional filter by specific tool name |
migrate_tool_stats
Recalculate Tool aggregates from existing ToolCall nodes. Returns a dictionary with migration counts.
async def migrate_tool_stats() -> dict[str, int]: ...
get_tool_usage_stats
Deprecated compatibility operation returning a dictionary of tool name to minimal Tool models. Use get_tool_stats for aggregate counts and durations.
async def get_tool_usage_stats(tool_name: str | None=None) -> dict[str, Tool]: ...
| Parameter | Description |
|---|---|
|
Optional filter by tool name |
NAMS lifecycle and operations
NAMS exposes flat steps belonging to a conversation and tool calls belonging to a step. The Python wrapper holds a trace-ID-to-conversation mapping in this client instance; it does not create a server Trace record.
| Operation | Hosted behavior |
|---|---|
|
Creates local trace metadata and a UUID; |
|
Requires a trace started by this client instance. Sends |
|
Sends status, result, and duration when supplied. Arguments and result are JSON strings in the request; bolt error/auto-observation/message/provenance kwargs are not sent. |
|
Updates local outcome, success, and completion time; returns None. It does not persist completion to the service. |
|
Returns local trace metadata, or None when unknown to this client instance. |
|
Requires the local mapping, then fetches all steps for that conversation. Two synthetic traces in the same conversation do not partition the server’s steps. |
|
Fetches the conversation’s steps as one aggregate trace with a new local ID and task text |
|
Returns an empty string. |
|
No-op. |
|
Raise |
|
Not defined on the NAMS reasoning store; accessing them raises |
Save conversation IDs for later retrieval. Synthetic trace IDs, task labels, and outcomes are not durable across client instances. For durable hosted reasoning data, consume the recorded conversation steps and tool calls. See REST endpoint mappings.