This reference is auto-generated from SDK docstrings.
Run
python scripts/generate_api_docs.py to regenerate.Constructor
Class methods
bootstrap
Instance methods
health
query_memories_async
query_memories.
augment_with_memories_async
augment_with_memories.
query_memories
Returns: List of MemoryResponse objects, ranked by blended score.
get_skill
get_skill_async
get_skill.
create_skill
augment_with_memories
Returns: AugmentedTask with augmented_task (task + memory blocks) and memories.
trace
ctx.augmented_task and ctx.memories. Call
ctx.set_output(...) inside the block to record your agent’s
result. On exit, the trace is submitted with the correct
retrieved_memory_ids automatically.
trace_async
trace.
create_trace
TraceCreateResponse — the trace is ingested in the
background, so your agent can move on to the next request without
waiting.
If you already know whether the response was correct (e.g. you
compared it to an expected answer), pass review_result to
include an inline review. Reflect will then generate a
reflection and store it as a new memory in the background, so
future runs of your agent can learn from this outcome.
If you don’t know the result yet, omit review_result and
review later via review_trace or the web dashboard.
Returns: A
TraceCreateResponse with the trace id and its ingest_status (typically "queued").
Example — log your agent’s run for later review
"success" and "failure" are aliases for the API’s "pass" and "fail". The SDK maps them automatically.create_trace_async
create_trace. Same parameters and return type. Uses asyncio.sleep between polls where applicable.
create_memory
create_trace, you supply the reflection yourself —
Reflect stores it directly with the pass/fail result and skips
background LLM reflection generation. Pass retrieved_memory_ids
so the memories you used get Q-learning credit.
Returns: A
TraceCreateResponse (ingest_status is typically "completed" — authored reflections are stored synchronously).
create_memory_async
create_memory. Same parameters and return type. Uses asyncio.sleep between polls where applicable.
wait_for_trace
wait_for_trace_async
wait_for_trace. Same parameters and return type. Uses asyncio.sleep between polls where applicable.
create_trace_and_wait
- Evaluation loops where you run multiple tasks in sequence and need each memory to exist before the next task starts, so your agent can learn from earlier mistakes within the same run.
- Tests where you want to assert on the created memory or the final review status.
- Scripts and pipelines where you need confirmation that the reflection was stored before moving on.
- Without
review_result: waits until the trace is stored. - With
review_result: waits until the review is processed, the reflection is generated, and the memory is saved. The returnedTraceResponsewill havereview_status == "reviewed"and a populatedcreated_memory_id.
create_trace instead — it returns
immediately while processing happens in the background.
Returns: The fully processed
TraceResponse with the attached ReviewResponse and created_memory_id (when reviewed).
Raises: RuntimeError — If processing fails — e.g. the LLM errored while generating the reflection. Check trace.last_ingest_error for details. TimeoutError — If processing doesn’t finish within wait_timeout seconds.
Example — evaluation loop that learns across tasks
"success" and "failure" are aliases for the API’s "pass" and "fail". The SDK maps them automatically.create_trace_and_wait_async
create_trace_and_wait. Same parameters and return type. Uses asyncio.sleep between polls where applicable.
list_traces
Returns: List of TraceResponse objects.
get_trace
get_trace_async
get_trace. Same parameters and return type. Uses asyncio.sleep between polls where applicable.
review_trace
Returns: The updated TraceResponse with the review attached.