diff --git a/docs.json b/docs.json
index 7875accd8e..aa280738a6 100644
--- a/docs.json
+++ b/docs.json
@@ -1310,6 +1310,7 @@
"weave/reference/typescript-sdk/type-aliases/response",
"weave/reference/typescript-sdk/type-aliases/role",
"weave/reference/typescript-sdk/type-aliases/session",
+ "weave/reference/typescript-sdk/type-aliases/session-1",
"weave/reference/typescript-sdk/type-aliases/sessioninit",
"weave/reference/typescript-sdk/type-aliases/settings"
]
diff --git a/weave/reference/python-sdk.mdx b/weave/reference/python-sdk.mdx
index 094f5e8088..1c15e60258 100644
--- a/weave/reference/python-sdk.mdx
+++ b/weave/reference/python-sdk.mdx
@@ -10,7 +10,7 @@ import { SourceLink } from '/snippets/_includes/source-link.mdx';
---
-
+
## class `Agent`
@@ -24,7 +24,7 @@ import { SourceLink } from '/snippets/_includes/source-link.mdx';
- `system_message`: ``
- `tools`: `list[typing.Any]`
-
+
### method `step`
@@ -44,7 +44,7 @@ Run a step of the agent.
---
-
+
## class `AgentState`
@@ -57,7 +57,7 @@ Run a step of the agent.
---
-
+
## class `AnnotationSpec`
@@ -69,7 +69,7 @@ Run a step of the agent.
- `unique_among_creators`: ``
- `op_scope`: `list[str] | None`
-
+
### classmethod `preprocess_field_schema`
@@ -79,7 +79,7 @@ preprocess_field_schema(data: Any) → Any
---
-
+
### classmethod `validate_field_schema`
@@ -89,7 +89,7 @@ validate_field_schema(schema: dict[str, Any]) → dict[str, Any]
---
-
+
### method `value_is_valid`
@@ -109,7 +109,20 @@ Validates a payload against this annotation spec's schema.
---
-
+
+
+## class `Any`
+Special type indicating an unconstrained type.
+
+- Any is compatible with every type.
+- Any assumed to have all methods.
+- All values assumed to be instances of Any.
+
+Note that all the above statements are true from the point of view of static type checkers. At runtime, Any should not be used with instance checks.
+
+---
+
+
## class `Audio`
A class representing audio data in a supported format (wav or mp3).
@@ -131,7 +144,7 @@ This class handles audio data storage and provides methods for loading from diff
- `ValueError`: If audio data is empty or format is not supported
-
+
### method `__init__`
@@ -145,7 +158,7 @@ __init__(
---
-
+
### method `export`
@@ -160,7 +173,7 @@ Export audio data to a file.
---
-
+
### classmethod `from_data`
@@ -186,7 +199,7 @@ Create an Audio object from raw data and specified format.
---
-
+
### classmethod `from_path`
@@ -210,7 +223,7 @@ Create an Audio object from a file path.
---
-
+
## class `ClassifierMonitor`
A monitor that merges multiple scorers into a single classifier.
@@ -232,7 +245,7 @@ Classifier monitors combine prompts from multiple LLMAsAJudgeScorers targeting t
- `prompt_header`: `str | None`
- `prompt_footer`: `str | None`
-
+
### method `activate`
@@ -247,7 +260,7 @@ Activates the monitor.
---
-
+
### method `deactivate`
@@ -262,7 +275,7 @@ Deactivates the monitor.
---
-
+
### classmethod `from_obj`
@@ -272,7 +285,7 @@ from_obj(obj: WeaveObject) → Self
---
-
+
### method `get_prompt_footer`
@@ -284,7 +297,7 @@ Text to append after the merged classifier prompts.
---
-
+
### method `get_prompt_header`
@@ -296,7 +309,7 @@ Text to prepend before the merged classifier prompts.
---
-
+
### method `model_post_init`
@@ -314,7 +327,7 @@ There is an edge case where a monitor can be created using the SDK without norma
---
-
+
## class `Content`
A class to represent content from various sources, resolving them to a unified byte-oriented representation with associated metadata.
@@ -327,7 +340,7 @@ This class must be instantiated using one of its classmethods:
- from_base64()
- from_data_url()
-
+
### method `__init__`
@@ -358,7 +371,7 @@ Direct initialization is disabled. Please use a classmethod like `Content.from_p
---
-
+
### method `as_string`
@@ -373,7 +386,7 @@ Display the data as a string. Bytes are decoded using the `encoding` attribute I
---
-
+
### classmethod `from_base64`
@@ -390,7 +403,7 @@ Initializes Content from a base64 encoded string or bytes.
---
-
+
### classmethod `from_bytes`
@@ -408,7 +421,7 @@ Initializes Content from raw bytes.
---
-
+
### classmethod `from_data_url`
@@ -420,7 +433,7 @@ Initializes Content from a data URL.
---
-
+
### classmethod `from_path`
@@ -437,7 +450,7 @@ Initializes Content from a local file path.
---
-
+
### classmethod `from_text`
@@ -455,7 +468,7 @@ Initializes Content from a string of text.
---
-
+
### classmethod `from_url`
@@ -474,7 +487,7 @@ Downloads the content, infers mimetype/extension from headers, URL path, and dat
---
-
+
### classmethod `model_validate`
@@ -494,7 +507,7 @@ Override model_validate to handle Content reconstruction from dict.
---
-
+
### classmethod `model_validate_json`
@@ -513,7 +526,7 @@ Override model_validate_json to handle Content reconstruction from JSON.
---
-
+
### method `open`
@@ -531,7 +544,7 @@ This method uses the platform-specific mechanism to open the file with the defau
---
-
+
### method `save`
@@ -546,7 +559,7 @@ Copy the file to the specified destination path. Updates the filename and the pa
---
-
+
### method `serialize_data`
@@ -558,7 +571,7 @@ When dumping model in json mode
---
-
+
### method `to_data_url`
@@ -578,7 +591,7 @@ Constructs a data URL from the content.
---
-
+
## class `Conversation`
A conversation. Groups turns by conversation_id (no span).
@@ -598,7 +611,7 @@ A conversation. Groups turns by conversation_id (no span).
- `continue_parent_trace`: ``
- `attributes`: `dict[str, typing.Any]`
-
+
### method `end`
@@ -608,7 +621,7 @@ end() → None
---
-
+
### method `model_post_init`
@@ -618,7 +631,7 @@ model_post_init(context: 'Any') → None
---
-
+
### method `start_turn`
@@ -642,7 +655,18 @@ Sets the ``_current_turn`` contextvar so the turn is visible via ``get_current_t
---
-
+
+
+## class `CustomRuntimeID`
+
+**Pydantic Fields:**
+
+- `id`: ``
+- `max_tokens`: ``
+
+---
+
+
## class `Dataset`
Dataset object with easy saving and automatic versioning.
@@ -673,7 +697,7 @@ example_label = dataset_ref.rows[2]['sentence']
- `ref`: `trace.refs.ObjectRef | None`
- `rows`: `trace.table.Table | trace.vals.WeaveTable`
-
+
### method `add_rows`
@@ -694,7 +718,7 @@ This is useful for adding examples to large datasets without having to load the
---
-
+
### classmethod `convert_to_table`
@@ -704,7 +728,7 @@ convert_to_table(rows: Any) → Table | WeaveTable
---
-
+
### classmethod `from_calls`
@@ -714,7 +738,7 @@ from_calls(calls: Iterable[Call]) → Self
---
-
+
### classmethod `from_hf`
@@ -724,7 +748,7 @@ from_hf(hf_dataset: 'HFDataset | HFDatasetDict') → Self
---
-
+
### classmethod `from_obj`
@@ -734,7 +758,7 @@ from_obj(obj: WeaveObject) → Self
---
-
+
### classmethod `from_pandas`
@@ -744,7 +768,7 @@ from_pandas(df: 'DataFrame') → Self
---
-
+
### method `select`
@@ -763,7 +787,7 @@ Select rows from the dataset based on the provided indices.
---
-
+
### method `to_hf`
@@ -773,7 +797,7 @@ to_hf() → HFDataset
---
-
+
### method `to_pandas`
@@ -783,11 +807,11 @@ to_pandas() → DataFrame
---
-
+
## class `EasyPrompt`
-
+
### method `__init__`
@@ -843,7 +867,7 @@ Join all messages into a system prompt object.
---
-
+
### method `append`
@@ -853,7 +877,7 @@ append(item: Any, role: str | None = None, dedent: bool = False) → None
---
-
+
### method `as_dict`
@@ -863,7 +887,7 @@ as_dict() → dict[str, Any]
---
-
+
### method `as_pydantic_dict`
@@ -873,7 +897,7 @@ as_pydantic_dict() → dict[str, Any]
---
-
+
### method `bind`
@@ -883,7 +907,7 @@ bind(*args: Any, **kwargs: Any) → Prompt
---
-
+
### method `bind_rows`
@@ -893,7 +917,7 @@ bind_rows(dataset: list[dict] | Any) → list['Prompt']
---
-
+
### method `config_table`
@@ -903,7 +927,7 @@ config_table(title: str | None = None) → Table
---
-
+
### method `configure`
@@ -913,7 +937,7 @@ configure(config: dict | None = None, **kwargs: Any) → Prompt
---
-
+
### method `dump`
@@ -923,7 +947,7 @@ dump(fp: ) → None
---
-
+
### method `dump_file`
@@ -933,7 +957,7 @@ dump_file(filepath: str | Path) → None
---
-
+
### method `format`
@@ -943,7 +967,7 @@ format(**kwargs: Any) → Any
---
-
+
### classmethod `from_obj`
@@ -953,7 +977,7 @@ from_obj(obj: WeaveObject) → Self
---
-
+
### classmethod `load`
@@ -963,7 +987,7 @@ load(fp: ) → Self
---
-
+
### classmethod `load_file`
@@ -973,7 +997,7 @@ load_file(filepath: str | Path) → Self
---
-
+
### method `messages_table`
@@ -983,7 +1007,7 @@ messages_table(title: str | None = None) → Table
---
-
+
### method `print`
@@ -993,7 +1017,7 @@ print() → str
---
-
+
### method `publish`
@@ -1007,7 +1031,7 @@ publish(
---
-
+
### method `require`
@@ -1017,7 +1041,7 @@ require(param_name: str, **kwargs: Any) → Prompt
---
-
+
### method `run`
@@ -1027,7 +1051,7 @@ run() → Any
---
-
+
### method `validate_requirement`
@@ -1037,7 +1061,7 @@ validate_requirement(key: str, value: Any) → list
---
-
+
### method `validate_requirements`
@@ -1047,7 +1071,7 @@ validate_requirements(values: dict[str, Any]) → list
---
-
+
### method `values_table`
@@ -1057,7 +1081,7 @@ values_table(title: str | None = None) → Table
---
-
+
## class `Evaluation`
Sets up an evaluation which includes a set of scorers and a dataset.
@@ -1105,13 +1129,13 @@ asyncio.run(evaluation.evaluate(function_to_evaluate))
- `description`: `str | None`
- `ref`: `trace.refs.ObjectRef | None`
- `dataset`: ``
-- `scorers`: `list[typing.Annotated[trace.op_protocol.Op | flow.scorer.Scorer, BeforeValidator(func=, json_schema_input_type=PydanticUndefined)]] | None`
+- `scorers`: `list[typing.Annotated[trace.op_protocol.Op | flow.scorer.Scorer, BeforeValidator(func=, json_schema_input_type=PydanticUndefined)]] | None`
- `preprocess_model_input`: `collections.abc.Callable[[dict], dict] | None`
- `trials`: ``
- `metadata`: `dict[str, typing.Any] | None`
- `evaluation_name`: `str | collections.abc.Callable[trace.call.Call, str] | None`
-
+
### method `evaluate`
@@ -1121,7 +1145,7 @@ evaluate(model: Op | Model) → dict
---
-
+
### classmethod `from_obj`
@@ -1131,7 +1155,7 @@ from_obj(obj: WeaveObject) → Self
---
-
+
### method `get_eval_results`
@@ -1141,7 +1165,7 @@ get_eval_results(model: Op | Model) → EvaluationResults
---
-
+
### method `get_evaluate_calls`
@@ -1172,7 +1196,7 @@ for call in calls:
---
-
+
### method `get_score_calls`
@@ -1200,7 +1224,7 @@ for trace_id, calls in score_calls.items():
---
-
+
### method `get_scores`
@@ -1242,7 +1266,7 @@ Expected output:
---
-
+
### method `model_post_init`
@@ -1252,7 +1276,7 @@ model_post_init(context: Any) → None
---
-
+
### method `predict_and_score`
@@ -1262,7 +1286,7 @@ predict_and_score(model: Op | Model, example: dict) → dict
---
-
+
### method `summarize`
@@ -1272,7 +1296,7 @@ summarize(eval_table: EvaluationResults) → dict
---
-
+
## class `EvaluationLogger`
This class provides an imperative interface for logging evaluations.
@@ -1311,7 +1335,10 @@ with ev.log_prediction(inputs={'q': 'Hello'}) as pred:
ev.log_summary({"avg_score": 0.9})
```
-
+**Args:**
+
+
+
### method `__init__`
@@ -1321,7 +1348,8 @@ __init__(
model: 'Model | dict | str | None' = None,
dataset: 'Dataset | list[dict] | str | None' = None,
eval_attributes: 'dict[str, Any] | None' = None,
- scorers: 'list[str] | None' = None
+ scorers: 'list[str] | None' = None,
+ trace_scores: 'bool' = True
) → None
```
@@ -1335,7 +1363,7 @@ __init__(
---
-
+
### method `fail`
@@ -1347,7 +1375,7 @@ Convenience method to fail the evaluation with an exception.
---
-
+
### method `finish`
@@ -1361,7 +1389,7 @@ Ensures all prediction calls and the main evaluation call are finalized. This is
---
-
+
### method `log_example`
@@ -1377,6 +1405,7 @@ Log a complete example with inputs, output, and scores.
This is a convenience method that combines log_prediction and log_score for when you have all the data upfront.
+ - `trace_scores`: Whether each logged score also emits its own scorer call. Defaults to True. `EvalTable` passes False because it already stores each score directly on the row. The score remains on the prediction and in automatic summaries, while skipping the individually inspectable scorer call. This avoids a call per score, the dominant cost when logging tables with many score columns.
**Args:**
@@ -1395,12 +1424,19 @@ ev.log_example(
---
-
+
### method `log_prediction`
```python
-log_prediction(inputs: 'dict[str, Any]', output: 'Any' = None) → ScoreLogger
+log_prediction(
+ inputs: 'dict[str, Any]',
+ output: 'Any' = None,
+ example_id: 'str | None' = None,
+ row_digest: 'str | None' = None,
+ trial_index: 'int | None' = None,
+ eval_kind: 'str | None' = 'agent'
+) → ScoreLogger
```
Log a prediction to the Evaluation.
@@ -1412,6 +1448,10 @@ Returns a ScoreLogger that can be used directly or as a context manager.
- `inputs`: The input data for the prediction
- `output`: The output value. Defaults to None. Can be set later using pred.output.
+ - `example_id`: Optional caller-provided example identifier for OTel spans.
+ - `row_digest`: Optional stable row identity. Defaults to a digest of inputs.
+ - `trial_index`: Optional zero-based trial index for this row digest.
+ - `eval_kind`: Optional eval kind for OTel spans. Defaults to "agent".
**Returns:**
ScoreLogger for logging scores and optionally finishing the prediction.
@@ -1423,7 +1463,7 @@ Example (context manager):
---
-
+
### method `log_summary`
@@ -1437,7 +1477,7 @@ This will calculate the summary, call the summarize op, and then finalize the ev
---
-
+
### method `set_view`
@@ -1475,12 +1515,12 @@ Saves the provided content as an object in the project and writes its reference
---
-
+
## class `File`
A class representing a file with path, mimetype, and size information.
-
+
### method `__init__`
@@ -1507,7 +1547,7 @@ Get the filename of the file.
---
-
+
### method `open`
@@ -1525,7 +1565,7 @@ This method uses the platform-specific mechanism to open the file with the defau
---
-
+
### method `save`
@@ -1540,7 +1580,7 @@ Copy the file to the specified destination path.
---
-
+
## class `LLM`
One LLM API call. Maps to a chat OTel span.
@@ -1571,7 +1611,7 @@ One LLM API call. Maps to a chat OTel span.
- `started_at`: `datetime.datetime | None`
- `ended_at`: `datetime.datetime | None`
-
+
### method `add_event`
@@ -1595,7 +1635,7 @@ Must be called between span start and span end (inside ``with``). Outside that w
---
-
+
### method `attach_media`
@@ -1617,7 +1657,7 @@ The publish (which uploads the media) runs on a dedicated background thread so t
---
-
+
### method `attach_media_url`
@@ -1631,7 +1671,7 @@ Convenience over ``attach_media`` for the common case where the caller has a URL
---
-
+
### method `end`
@@ -1641,7 +1681,7 @@ end() → None
---
-
+
### method `model_post_init`
@@ -1651,7 +1691,7 @@ model_post_init(context: 'Any') → None
---
-
+
### method `output`
@@ -1663,7 +1703,7 @@ Append an assistant message to output_messages.
---
-
+
### method `record`
@@ -1689,7 +1729,19 @@ Only fields explicitly passed (non-``None``) are applied — existing values are
---
-
+
+
+### method `record_error`
+
+```python
+record_error(error: 'BaseException') → Self
+```
+
+Record a failure without ending the span; call ``end()`` when ready.
+
+---
+
+
### method `set_attributes`
@@ -1705,7 +1757,7 @@ Must be called between span start and span end — i.e. inside a ``with`` block.
---
-
+
### method `think`
@@ -1717,7 +1769,7 @@ Set reasoning/chain-of-thought content.
---
-
+
## class `LogResult`
Result of a batch log_* call.
@@ -1731,7 +1783,7 @@ Result of a batch log_* call.
---
-
+
## class `Markdown`
A Markdown renderable.
@@ -1744,7 +1796,7 @@ A Markdown renderable.
- `style` (Union[str, Style], optional): Optional style to apply to markdown.
- `hyperlinks` (bool, optional): Enable hyperlinks. Defaults to ``True``.
-
+
### method `__init__`
@@ -1762,7 +1814,7 @@ __init__(
---
-
+
## class `MediaAttachment`
A media attachment on an LLM call.
@@ -1779,7 +1831,7 @@ Always holds a ``weave://`` content ref URI. Raw bytes, data-URLs, and plain HT
---
-
+
## class `Message`
A single message in a conversation.
@@ -1800,7 +1852,7 @@ When ``parts`` is non-empty it is the canonical representation. When empty, the
- `tool_name`: ``
- `parts`: `list[typing.Annotated[conversation.types.TextPart | conversation.types.ReasoningPart | conversation.types.ToolCallPart | conversation.types.ToolCallResponsePart | conversation.types.BlobPart | conversation.types.UriPart | conversation.types.FilePart, FieldInfo(annotation=NoneType, required=True, discriminator='type')]]`
-
+
### classmethod `assistant`
@@ -1817,7 +1869,7 @@ Use plain text for simple replies; pass ``tool_calls`` when the assistant reques
---
-
+
### classmethod `system`
@@ -1829,7 +1881,7 @@ Build a system message from plain text.
---
-
+
### classmethod `tool_result`
@@ -1843,7 +1895,7 @@ Build a tool-result message for a previously-requested tool call.
---
-
+
### classmethod `user`
@@ -1855,11 +1907,11 @@ Build a user message from plain text.
---
-
+
## class `MessagesPrompt`
-
+
### method `__init__`
@@ -1874,7 +1926,7 @@ __init__(messages: list[dict])
- `ref`: `trace.refs.ObjectRef | None`
- `messages`: `list[dict]`
-
+
### method `format`
@@ -1884,7 +1936,7 @@ format(**kwargs: Any) → list
---
-
+
### method `format_message`
@@ -1898,7 +1950,7 @@ This method delegates to the standalone format_message_with_template_vars functi
---
-
+
### classmethod `from_obj`
@@ -1908,7 +1960,7 @@ from_obj(obj: WeaveObject) → Self
---
-
+
## class `Model`
Intended to capture a combination of code and data the operates on an input. For example it might call an LLM with a prompt to make a prediction or generate text.
@@ -1934,7 +1986,7 @@ class YourModel(Model):
- `description`: `str | None`
- `ref`: `trace.refs.ObjectRef | None`
-
+
### method `get_infer_method`
@@ -1944,7 +1996,7 @@ get_infer_method() → Callable
---
-
+
## class `Monitor`
Sets up a monitor to score incoming calls automatically.
@@ -1995,7 +2047,7 @@ my_monitor.activate()
- `active`: ``
- `scorer_debounce_config`: `flow.monitor.ScorerDebounceConfig | None`
-
+
### method `activate`
@@ -2010,7 +2062,7 @@ Activates the monitor.
---
-
+
### method `deactivate`
@@ -2025,7 +2077,7 @@ Deactivates the monitor.
---
-
+
### classmethod `from_obj`
@@ -2035,7 +2087,7 @@ from_obj(obj: WeaveObject) → Self
---
-
+
### method `model_post_init`
@@ -2053,7 +2105,7 @@ There is an edge case where a monitor can be created using the SDK without norma
---
-
+
## class `Object`
Base class for Weave objects that can be tracked and versioned.
@@ -2081,7 +2133,7 @@ obj = Object.from_uri("weave:///entity/project/object:digest")
- `description`: `str | None`
- `ref`: `trace.refs.ObjectRef | None`
-
+
### classmethod `from_uri`
@@ -2111,7 +2163,7 @@ obj = MyObject.from_uri("weave:///entity/project/object:digest")
---
-
+
### classmethod `handle_relocatable_object`
@@ -2148,7 +2200,7 @@ This validator handles special cases where the input is an ObjectRef or WeaveObj
---
-
+
### classmethod `strip_weave_serialization_metadata`
@@ -2162,12 +2214,12 @@ Weave's serialization adds _type, _class_name, and _bases to dicts for type reco
---
-
+
## class `ObjectRef`
ObjectRef(entity: 'str', project: 'str', name: 'str', _digest: 'str | Future[str]', _extra: 'tuple[str | Future[str], ...]' = ())
-
+
### method `__init__`
@@ -2195,7 +2247,7 @@ __init__(
---
-
+
### method `as_param_dict`
@@ -2205,7 +2257,7 @@ as_param_dict() → dict
---
-
+
### method `delete`
@@ -2215,7 +2267,7 @@ delete() → None
---
-
+
### method `get`
@@ -2225,7 +2277,7 @@ get(objectify: 'bool' = True) → Any
---
-
+
### method `is_descended_from`
@@ -2235,7 +2287,7 @@ is_descended_from(potential_ancestor: 'ObjectRef') → bool
---
-
+
### method `maybe_parse_uri`
@@ -2245,7 +2297,7 @@ maybe_parse_uri(s: 'str') → AnyRef | None
---
-
+
### method `parse_uri`
@@ -2255,7 +2307,7 @@ parse_uri(uri: 'str') → ObjectRef
---
-
+
### method `with_attr`
@@ -2265,7 +2317,7 @@ with_attr(attr: 'str') → Self
---
-
+
### method `with_extra`
@@ -2275,7 +2327,7 @@ with_extra(extra: 'tuple[str | Future[str], ]') → Self
---
-
+
### method `with_index`
@@ -2285,7 +2337,7 @@ with_index(index: 'int') → Self
---
-
+
### method `with_item`
@@ -2295,7 +2347,7 @@ with_item(item_digest: 'str | Future[str]') → Self
---
-
+
### method `with_key`
@@ -2305,7 +2357,7 @@ with_key(key: 'str') → Self
---
-
+
## class `Prompt`
@@ -2315,7 +2367,7 @@ with_key(key: 'str') → Self
- `description`: `str | None`
- `ref`: `trace.refs.ObjectRef | None`
-
+
### method `format`
@@ -2325,12 +2377,12 @@ format(**kwargs: Any) → Any
---
-
+
## class `SavedView`
A fluent-style class for working with SavedView objects.
-
+
### method `__init__`
@@ -2356,7 +2408,7 @@ __init__(view_type: 'str' = 'traces', label: 'str' = 'SavedView') → None
---
-
+
### method `add_column`
@@ -2366,7 +2418,7 @@ add_column(path: 'str | ObjectPath', label: 'str | None' = None) → SavedView
---
-
+
### method `add_columns`
@@ -2378,7 +2430,7 @@ Convenience method for adding multiple columns to the grid.
---
-
+
### method `add_filter`
@@ -2392,7 +2444,7 @@ add_filter(
---
-
+
### method `add_sort`
@@ -2402,7 +2454,7 @@ add_sort(field: 'str', direction: 'SortDirection') → SavedView
---
-
+
### method `column_index`
@@ -2412,7 +2464,7 @@ column_index(path: 'int | str | ObjectPath') → int
---
-
+
### method `filter_op`
@@ -2422,7 +2474,7 @@ filter_op(op_name: 'str | None') → SavedView
---
-
+
### method `get_calls`
@@ -2440,7 +2492,7 @@ Get calls matching this saved view's filters and settings.
---
-
+
### method `get_known_columns`
@@ -2452,7 +2504,7 @@ Get the set of columns that are known to exist.
---
-
+
### method `get_table_columns`
@@ -2462,7 +2514,7 @@ get_table_columns() → list[TableColumn]
---
-
+
### method `hide_column`
@@ -2472,7 +2524,7 @@ hide_column(col_name: 'str') → SavedView
---
-
+
### method `insert_column`
@@ -2486,7 +2538,7 @@ insert_column(
---
-
+
### classmethod `load`
@@ -2496,7 +2548,7 @@ load(ref: 'str') → Self
---
-
+
### method `page_size`
@@ -2506,7 +2558,7 @@ page_size(page_size: 'int') → SavedView
---
-
+
### method `pin_column_left`
@@ -2516,7 +2568,7 @@ pin_column_left(col_name: 'str') → SavedView
---
-
+
### method `pin_column_right`
@@ -2526,7 +2578,7 @@ pin_column_right(col_name: 'str') → SavedView
---
-
+
### method `remove_column`
@@ -2536,7 +2588,7 @@ remove_column(path: 'int | str | ObjectPath') → SavedView
---
-
+
### method `remove_columns`
@@ -2548,7 +2600,7 @@ Remove columns from the saved view.
---
-
+
### method `remove_filter`
@@ -2558,7 +2610,7 @@ remove_filter(index_or_field: 'int | str') → SavedView
---
-
+
### method `remove_filters`
@@ -2570,7 +2622,7 @@ Remove all filters from the saved view.
---
-
+
### method `rename`
@@ -2580,7 +2632,7 @@ rename(label: 'str') → SavedView
---
-
+
### method `rename_column`
@@ -2590,7 +2642,7 @@ rename_column(path: 'int | str | ObjectPath', label: 'str') → SavedView
---
-
+
### method `save`
@@ -2602,7 +2654,7 @@ Publish the saved view to the server.
---
-
+
### method `set_columns`
@@ -2614,7 +2666,7 @@ Set the columns to be displayed in the grid.
---
-
+
### method `show_column`
@@ -2624,7 +2676,7 @@ show_column(col_name: 'str') → SavedView
---
-
+
### method `sort_by`
@@ -2634,7 +2686,7 @@ sort_by(field: 'str', direction: 'SortDirection') → SavedView
---
-
+
### method `to_grid`
@@ -2644,7 +2696,7 @@ to_grid(limit: 'int | None' = None) → Grid
---
-
+
### method `to_rich_table_str`
@@ -2654,7 +2706,7 @@ to_rich_table_str() → str
---
-
+
### method `ui_url`
@@ -2668,7 +2720,7 @@ Note this is the "result" page with traces etc, not the URL for the view object.
---
-
+
### method `unpin_column`
@@ -2678,7 +2730,7 @@ unpin_column(col_name: 'str') → SavedView
---
-
+
## class `Scorer`
@@ -2693,7 +2745,7 @@ unpin_column(col_name: 'str') → SavedView
#### property display_name
-
+
### classmethod `from_obj`
@@ -2703,7 +2755,7 @@ from_obj(obj: WeaveObject) → Self
---
-
+
### method `model_post_init`
@@ -2713,7 +2765,7 @@ model_post_init(context: Any) → None
---
-
+
### method `score`
@@ -2723,7 +2775,7 @@ score(output: Any, **kwargs: Any) → Any
---
-
+
### method `summarize`
@@ -2733,14 +2785,14 @@ summarize(score_rows: list) → dict | None
---
-
+
## class `Session`
Deprecated alias of :class:`weave.Conversation`.
Accepts the old ``session_id`` / ``session_name`` constructor fields and also exposes them as read/write properties that proxy to ``conversation_id`` / ``conversation_name``. The original ``Session`` had these as model fields, so old code that reads or assigns ``s.session_id`` keeps working.
-
+
### method `__init__`
@@ -2773,11 +2825,21 @@ Deprecated alias of :attr:`conversation_name`.
---
-
+
## class `StringPrompt`
+A prompt template for plain text prompts.
+
+Add variables in braces, then pass values for those variables to `format` to produce the final prompt text.
+
+**Example:**
+ prompt = StringPrompt("Hello {name}") prompt.format(name="Ada") 'Hello Ada'
+
+**Raises:**
+
+ - `KeyError`: If you call `format` without a required template variable.
-
+
### method `__init__`
@@ -2792,7 +2854,7 @@ __init__(content: str)
- `ref`: `trace.refs.ObjectRef | None`
- `content`: ``
-
+
### method `format`
@@ -2802,7 +2864,7 @@ format(**kwargs: Any) → str
---
-
+
### classmethod `from_obj`
@@ -2812,7 +2874,7 @@ from_obj(obj: WeaveObject) → Self
---
-
+
## class `SubAgent`
A delegated agent invocation within a turn.
@@ -2827,10 +2889,16 @@ Maps to a nested invoke_agent OTel span in the same trace.
- `agent_description`: ``
- `agent_version`: ``
- `system_instructions`: `list[str]`
+- `input_messages`: `list[conversation.types.Message]`
+- `output_messages`: `list[conversation.types.Message]`
+- `tool_name`: ``
+- `tool_call_id`: ``
+- `tool_call_arguments`: ``
+- `tool_call_result`: ``
- `started_at`: `datetime.datetime | None`
- `ended_at`: `datetime.datetime | None`
-
+
### method `add_event`
@@ -2854,7 +2922,7 @@ Must be called between span start and span end (inside ``with``). Outside that w
---
-
+
### method `end`
@@ -2864,7 +2932,7 @@ end() → None
---
-
+
### method `llm`
@@ -2876,13 +2944,11 @@ llm(
) → LLM
```
-Start an LLM call within this sub-agent.
-
-Sets the ``_current_llm`` contextvar so the LLM is visible via ``get_current_llm()`` regardless of whether a context manager is used.
+Deprecated alias for :meth:`start_llm`.
---
-
+
### method `record`
@@ -2891,6 +2957,12 @@ record(
name: 'str | None' = None,
model: 'str | None' = None,
system_instructions: 'list[str] | None' = None,
+ input_messages: 'list[Message] | None' = None,
+ output_messages: 'list[Message] | None' = None,
+ tool_name: 'str | None' = None,
+ tool_call_id: 'str | None' = None,
+ tool_call_arguments: 'str | None' = None,
+ tool_call_result: 'str | None' = None,
agent_id: 'str | None' = None,
agent_description: 'str | None' = None,
agent_version: 'str | None' = None
@@ -2905,7 +2977,19 @@ Note: on the streaming (``with``) path the sub-agent span is named from ``name``
---
-
+
+
+### method `record_error`
+
+```python
+record_error(error: 'BaseException') → Self
+```
+
+Record a failure without ending the span; call ``end()`` when ready.
+
+---
+
+
### method `set_attributes`
@@ -2921,7 +3005,67 @@ Must be called between span start and span end — i.e. inside a ``with`` block.
---
-
+
+
+### method `start`
+
+```python
+start(set_current: 'bool' = True) → Self
+```
+
+Start this sub-agent's span. ``__enter__`` without the ``with``.
+
+Pass ``set_current=False`` when sub-agents can be in flight concurrently. ``end()`` detaches via ``ContextVar.reset``, which silently corrupts the ambient context stack when overlapping spans end out of LIFO order — the surviving sibling stops being current, and the last detach restores an already-ended span. Children created through ``start_llm`` / ``start_tool`` / ``start_subagent`` nest under this span either way, because those factories thread an explicit parent context.
+
+---
+
+
+
+### method `start_llm`
+
+```python
+start_llm(
+ model: 'str' = '',
+ provider_name: 'str' = '',
+ system_instructions: 'list[str] | None' = None
+) → LLM
+```
+
+Start an LLM call within this sub-agent.
+
+Sets the ``_current_llm`` contextvar so the LLM is visible via ``get_current_llm()`` regardless of whether a context manager is used. Pins the LLM's OTel parent to this SubAgent's span when the SubAgent has been entered.
+
+---
+
+
+
+### method `start_subagent`
+
+```python
+start_subagent(name: 'str', model: 'str' = '') → SubAgent
+```
+
+Start a nested sub-agent under this one.
+
+Pins the nested SubAgent's OTel parent to this SubAgent's span when this SubAgent has been entered.
+
+---
+
+
+
+### method `start_tool`
+
+```python
+start_tool(name: 'str', arguments: 'str' = '', tool_call_id: 'str' = '') → Tool
+```
+
+Start a tool execution within this sub-agent.
+
+Pins the Tool's OTel parent to this SubAgent's span when the SubAgent has been entered.
+
+---
+
+
### method `tool`
@@ -2929,15 +3073,15 @@ Must be called between span start and span end — i.e. inside a ``with`` block.
tool(name: 'str', arguments: 'str' = '', tool_call_id: 'str' = '') → Tool
```
-Start a tool execution within this sub-agent.
+Deprecated alias for :meth:`start_tool`.
---
-
+
## class `Table`
-
+
### method `__init__`
@@ -2951,7 +3095,7 @@ __init__(rows: 'list[dict]') → None
---
-
+
### method `append`
@@ -2963,7 +3107,7 @@ Add a row to the table.
---
-
+
### method `pop`
@@ -2975,7 +3119,7 @@ Remove a row at the given index from the table.
---
-
+
## class `ContextAwareThread`
A Thread that runs functions with the context of the caller.
@@ -2995,7 +3139,7 @@ thread = threading.Thread(target=run_with_context(your_func, *args, **kwargs))
thread.start()
```
-
+
### method `__init__`
@@ -3039,7 +3183,7 @@ This is a non-negative integer. See the get_native_id() function. This represent
---
-
+
### method `run`
@@ -3049,12 +3193,12 @@ run() → None
---
-
+
## class `ThreadContext`
Context object providing access to current thread and turn information.
-
+
### method `__init__`
@@ -3088,7 +3232,7 @@ Get the current turn_id from the active context.
---
-
+
## class `ContextAwareThreadPoolExecutor`
A ThreadPoolExecutor that runs functions with the context of the caller.
@@ -3107,7 +3251,7 @@ with concurrent.futures.ThreadPoolExecutor() as executor:
executor.map(_wrapped_fn, vals)
```
-
+
### method `__init__`
@@ -3117,7 +3261,7 @@ __init__(*args: 'Any', **kwargs: 'Any') → None
---
-
+
### method `map`
@@ -3132,7 +3276,7 @@ map(
---
-
+
### method `submit`
@@ -3142,7 +3286,7 @@ submit(fn: 'Callable', *args: 'Any', **kwargs: 'Any') → Any
---
-
+
## class `Tool`
One tool execution. Maps to an execute_tool OTel span.
@@ -3162,7 +3306,7 @@ One tool execution. Maps to an execute_tool OTel span.
- `started_at`: `datetime.datetime | None`
- `ended_at`: `datetime.datetime | None`
-
+
### method `add_event`
@@ -3186,7 +3330,7 @@ Must be called between span start and span end (inside ``with``). Outside that w
---
-
+
### method `end`
@@ -3196,7 +3340,19 @@ end() → None
---
-
+
+
+### method `record_error`
+
+```python
+record_error(error: 'BaseException') → Self
+```
+
+Record a failure without ending the span; call ``end()`` when ready.
+
+---
+
+
### method `set_attributes`
@@ -3212,7 +3368,7 @@ Must be called between span start and span end — i.e. inside a ``with`` block.
---
-
+
## class `Turn`
One user-agent exchange. Maps to an invoke_agent OTel span.
@@ -3228,12 +3384,13 @@ By default each turn starts its own OTel trace (``continue_parent_trace=False``)
- `agent_version`: ``
- `system_instructions`: `list[str]`
- `messages`: `list[conversation.types.Message]`
+- `output_messages`: `list[conversation.types.Message]`
- `spans`: `list[conversation.conversation.LLM | conversation.conversation.Tool | conversation.conversation.SubAgent]`
- `continue_parent_trace`: ``
- `started_at`: `datetime.datetime | None`
- `ended_at`: `datetime.datetime | None`
-
+
### method `add_event`
@@ -3257,7 +3414,7 @@ Must be called between span start and span end (inside ``with``). Outside that w
---
-
+
### method `end`
@@ -3267,7 +3424,7 @@ end() → None
---
-
+
### method `llm`
@@ -3279,13 +3436,11 @@ llm(
) → LLM
```
-Start an LLM call (chat span, child of this turn).
-
-Sets the ``_current_llm`` contextvar so the LLM is visible via ``get_current_llm()`` regardless of whether a context manager is used.
+Deprecated alias for :meth:`start_llm`.
---
-
+
### method `model_post_init`
@@ -3295,13 +3450,14 @@ model_post_init(context: 'Any') → None
---
-
+
### method `record`
```python
record(
messages: 'list[Message] | None' = None,
+ output_messages: 'list[Message] | None' = None,
system_instructions: 'list[str] | None' = None,
agent_name: 'str | None' = None,
model: 'str | None' = None,
@@ -3313,13 +3469,25 @@ record(
Set multiple turn fields in one call.
-Collapses the per-field assignments a manually-instrumented agent otherwise makes on a turn (``system_instructions``, ``agent_id``, ...) into a single keyword call. Only fields explicitly passed (non-``None``) are applied — existing values are preserved. ``messages`` **replaces** the turn's existing messages (unlike ``Turn.user(...)``, which appends a single message). Returns ``self`` for chaining. Mirrors ``LLM.record``.
+Collapses the per-field assignments a manually-instrumented agent otherwise makes on a turn (``system_instructions``, ``agent_id``, ...) into a single keyword call. Only fields explicitly passed (non-``None``) are applied — existing values are preserved. ``messages`` and ``output_messages`` independently replace the turn's existing input and output messages. This differs from ``Turn.user(...)``, which appends a single input message. Returns ``self`` for chaining. Mirrors ``LLM.record``.
Note: on the streaming (``with``) path the turn span is named from ``agent_name`` at ``__enter__``, so set ``agent_name`` via ``start_turn`` rather than ``record`` if you need the span name to reflect it; ``record`` still updates the ``gen_ai.agent.name`` attribute.
---
-
+
+
+### method `record_error`
+
+```python
+record_error(error: 'BaseException') → Self
+```
+
+Record a failure without ending the span; call ``end()`` when ready.
+
+---
+
+
### method `set_attributes`
@@ -3335,7 +3503,53 @@ Must be called between span start and span end — i.e. inside a ``with`` block.
---
-
+
+
+### method `start_llm`
+
+```python
+start_llm(
+ model: 'str' = '',
+ provider_name: 'str' = '',
+ system_instructions: 'list[str] | None' = None
+) → LLM
+```
+
+Start an LLM call (chat span, child of this turn).
+
+Sets the ``_current_llm`` contextvar so the LLM is visible via ``get_current_llm()`` regardless of whether a context manager is used.
+
+---
+
+
+
+### method `start_subagent`
+
+```python
+start_subagent(
+ name: 'str',
+ model: 'str' = '',
+ system_instructions: 'list[str] | None' = None
+) → SubAgent
+```
+
+Start a sub-agent invocation (nested invoke_agent span, same trace).
+
+---
+
+
+
+### method `start_tool`
+
+```python
+start_tool(name: 'str', arguments: 'str' = '', tool_call_id: 'str' = '') → Tool
+```
+
+Start a tool execution (execute_tool span, child of this turn).
+
+---
+
+
### method `subagent`
@@ -3347,11 +3561,11 @@ subagent(
) → SubAgent
```
-Start a sub-agent invocation (nested invoke_agent span, same trace).
+Deprecated alias for :meth:`start_subagent`.
---
-
+
### method `tool`
@@ -3359,11 +3573,11 @@ Start a sub-agent invocation (nested invoke_agent span, same trace).
tool(name: 'str', arguments: 'str' = '', tool_call_id: 'str' = '') → Tool
```
-Start a tool execution (execute_tool span, child of this turn).
+Deprecated alias for :meth:`start_tool`.
---
-
+
### method `user`
@@ -3375,7 +3589,7 @@ Append a user message mid-turn.
---
-
+
## class `Usage`
Token usage for an LLM call.
@@ -3390,7 +3604,7 @@ Token usage for an LLM call.
---
-
+
### function `add_tags`
@@ -3405,7 +3619,7 @@ Add tags to an object version.
---
-
+
### function `as_op`
@@ -3428,7 +3642,7 @@ Given a @weave.op decorated function, return its Op.
---
-
+
### function `attributes`
@@ -3446,7 +3660,7 @@ with weave.attributes({'env': 'production'}):
---
-
+
### function `end_conversation`
@@ -3458,7 +3672,7 @@ End the current conversation (from contextvar).
---
-
+
### function `end_llm`
@@ -3470,7 +3684,7 @@ End the current LLM call (from contextvar).
---
-
+
### function `end_session`
@@ -3482,7 +3696,7 @@ Deprecated alias of :func:`weave.end_conversation`.
---
-
+
### function `end_turn`
@@ -3494,7 +3708,7 @@ End the current turn (from contextvar).
---
-
+
### function `finish`
@@ -3508,7 +3722,7 @@ Following finish, calls of weave.op decorated functions will no longer be logged
---
-
+
### function `get`
@@ -3538,7 +3752,7 @@ dataset2 = weave.get(ref) # same as dataset!
---
-
+
### function `get_aliases`
@@ -3557,7 +3771,7 @@ Get aliases for an object version.
---
-
+
### function `get_client`
@@ -3567,7 +3781,7 @@ get_client() → WeaveClient | None
---
-
+
### function `get_current_call`
@@ -3586,7 +3800,7 @@ Get the Call object for the currently executing Op, within that Op.
---
-
+
### function `get_current_conversation`
@@ -3598,7 +3812,7 @@ Return the active conversation from contextvar, or None.
---
-
+
### function `get_current_llm`
@@ -3610,7 +3824,7 @@ Return the active LLM call from contextvar, or None.
---
-
+
### function `get_current_session`
@@ -3622,7 +3836,7 @@ Deprecated alias of :func:`weave.get_current_conversation`.
---
-
+
### function `get_current_turn`
@@ -3634,7 +3848,7 @@ Return the active turn from contextvar, or None.
---
-
+
### function `get_tags`
@@ -3653,7 +3867,7 @@ Get tags for an object version.
---
-
+
### function `get_tags_and_aliases`
@@ -3672,7 +3886,7 @@ Get both tags and aliases for an object version in a single call.
---
-
+
### function `init`
@@ -3719,7 +3933,7 @@ NOTE: Client-level postprocessing runs after each op's own postprocessing. The o
---
-
+
### function `link_prompt_to_registry`
@@ -3745,7 +3959,7 @@ Link a published prompt version into the registry.
---
-
+
### function `list_aliases`
@@ -3760,7 +3974,7 @@ List all distinct aliases in the project.
---
-
+
### function `list_tags`
@@ -3775,7 +3989,7 @@ List all distinct tags in the project.
---
-
+
### function `log_call`
@@ -3862,7 +4076,7 @@ import weave
---
-
+
### function `log_conversation`
@@ -3890,7 +4104,7 @@ Each Turn's ``.spans`` attribute provides its children. Auto-generates ``convers
---
-
+
### function `log_session`
@@ -3913,7 +4127,7 @@ Deprecated alias of :func:`weave.log_conversation`.
---
-
+
### function `log_turn`
@@ -3927,6 +4141,7 @@ log_turn(
agent_description: 'str' = '',
agent_version: 'str' = '',
messages: 'list[Message] | None' = None,
+ output_messages: 'list[Message] | None' = None,
system_instructions: 'list[str] | None' = None,
spans: 'list[LLM | Tool | SubAgent] | None' = None,
started_at: 'datetime | None' = None,
@@ -3943,9 +4158,11 @@ Use when context managers aren't viable (stateless containers, callbacks, queue
``attributes`` are stamped on every emitted span; the streaming path reads these from the active conversation instead. Use custom, non-semconv keys: a key that collides with a span's own ``gen_ai.*`` / ``weave.*`` attribute is unsupported (which value wins is path-dependent).
+``messages`` records the turn input and ``output_messages`` records the terminal agent response on the same ``invoke_agent`` span.
+
---
-
+
### function `op`
@@ -3973,7 +4190,7 @@ A decorator to weave op-ify a function or method. Works for both sync and async.
---
-
+
### function `otel_traces_endpoint`
@@ -4000,7 +4217,7 @@ External callers (e.g. boot-time probes that want to verify the ingest endpoint
---
-
+
### function `publish`
@@ -4030,7 +4247,7 @@ Weave creates a new version of the object if the object's name already exists an
---
-
+
### function `ref`
@@ -4049,7 +4266,7 @@ Creates a Ref to an existing Weave object. This does not directly retrieve the o
---
-
+
### function `remove_aliases`
@@ -4064,7 +4281,7 @@ Remove one or more aliases from an object.
---
-
+
### function `remove_tags`
@@ -4081,7 +4298,7 @@ Remove tags from an object version.
---
-
+
### function `require_current_call`
@@ -4132,7 +4349,7 @@ print(call.id)
---
-
+
### function `set_aliases`
@@ -4147,7 +4364,7 @@ Set one or more aliases for an object version.
---
-
+
### function `set_view`
@@ -4189,7 +4406,7 @@ Attach a custom view to the current call summary at `_weave.views.`.
---
-
+
### function `start_conversation`
@@ -4211,7 +4428,7 @@ Create and activate a conversation. Sets the contextvar for cross-module access.
---
-
+
### function `start_llm`
@@ -4231,7 +4448,7 @@ Pass ``provider_name`` explicitly. The SDK does not infer it from the model iden
---
-
+
### function `start_session`
@@ -4253,7 +4470,7 @@ Deprecated alias of :func:`weave.start_conversation`.
---
-
+
### function `start_subagent`
@@ -4271,7 +4488,7 @@ The SubAgent's OTel span automatically becomes a child of whatever span is curre
---
-
+
### function `start_tool`
@@ -4285,7 +4502,7 @@ The Tool's OTel span automatically becomes a child of whatever span is current i
---
-
+
### function `start_turn`
@@ -4304,13 +4521,13 @@ If no conversation is active, returns a disconnected Turn that is NOT set in the
---
-
+
### function `thread`
```python
thread(
- thread_id: 'str | object | None' =