Skip to main content

API Overview


Source

class CrossProjectRefError

Raised when client-side digest computation encounters a ref to a different project that cannot be resolved to an internal ID.
Source

class FlushStatus

Status information about the current flush operation.
Source

class NoInternalProjectIDError

Raised when client-side digest computation cannot proceed because no internal project ID has been resolved yet.
Source

class PendingJobCounts

Counts of pending jobs for each type.
Source

class WeaveClient

Source

method __init__


property num_outstanding_jobs

Returns the total number of pending jobs across all executors and the server. This property can be used to check the progress of background tasks without blocking the main thread. Returns:
  • int: The total number of pending jobs

property project_id


Source

method add_calls_to_annotation_queue

Add calls to an annotation queue. Args:
Source

method add_cost

Add a cost to the current project.
  • queue_id: Annotation queue ID.
  • call_ids: Call IDs to add to the queue.
  • display_fields: JSON paths to show reviewers, such as inputs.prompt or output.text. Examples:
Args:
  • llm_id: The ID of the LLM. eg “gpt-4o-mini-2024-07-18”
  • prompt_token_cost: The cost per prompt token. eg .0005
  • completion_token_cost: The cost per completion token. eg .0015
  • effective_date: Defaults to the current date. A datetime.datetime object.
  • provider_id: The provider of the LLM. Defaults to “default”. eg “openai”
  • prompt_token_cost_unit: The unit of the cost for the prompt tokens. Defaults to “USD”. (Currently unused, will be used in the future to specify the currency type for the cost eg “tokens” or “time”)
  • completion_token_cost_unit: The unit of the cost for the completion tokens. Defaults to “USD”. (Currently unused, will be used in the future to specify the currency type for the cost eg “tokens” or “time”)
  • cache_read_input_token_cost: The cost per cache-read input token. Defaults to 0.
  • cache_creation_input_token_cost: The cost per cache-creation input token. Defaults to 0. Returns: A CostCreateResponse object. Which has one field called ids, a list of two-item lists. Each list holds the llm_id and the id of the created cost object.

Source

method add_tags

Add tags to an object version. Args:
Source

method clear_wandb_run_context

Clear wandb run context override. After calling this, calls will fall back to using the global wandb.run (if available) for run_id and step information.
  • obj_ref: Reference to the object version, either an ObjectRef or a weave /// URI string.
  • tags: List of tag strings to add. Examples:

Source

method create_annotation_queue

Create an annotation queue for this project. Args:
  • name: Display name for the queue.
  • scorer_refs: Weave refs for the scorers/annotation fields reviewers complete.
  • description: Optional reviewer guidelines or queue description. Returns: The ID of the created annotation queue.

Source

method create_call

Create, log, and push a call onto the runtime stack. Args:
  • op: The operation producing the call, or the name of an anonymous operation.
  • inputs: The inputs to the operation.
  • parent: The parent call. If parent is not provided, the current run is used as the parent.
  • display_name: The display name for the call. Defaults to None.
  • attributes: The attributes for the call. Defaults to None.
  • use_stack: Whether to push the call onto the runtime stack. Defaults to True.
  • started_at: Override the call start time. If None, uses current time. Returns: The created Call object.

Source

method delete_all_object_versions

Delete all versions of an object. Args:
  • object_name: The name of the object whose versions should be deleted. Returns: The number of versions deleted.

Source

method delete_all_op_versions

Delete all versions of an op. Args:
  • op_name: The name of the op whose versions should be deleted. Returns: The number of versions deleted.

Source

method delete_annotation_queue

Soft-delete an annotation queue.
Source

method delete_call


Source

method delete_calls

Delete calls by their IDs. Deleting a call will also delete all of its children. Args:
Source

method delete_object_version


Source

method delete_object_versions

Delete specific versions of an object.
  • call_ids: A list of call IDs to delete. Ex: [“2F0193e107-8fcf-7630-b576-977cc3062e2e”] Args:
  • object_name: The name of the object whose versions should be deleted.
  • digests: List of digests to delete. Can include aliases like “latest” or “v0”. Returns: The number of versions deleted.

Source

method delete_op_version


Source

method fail_call

Fail a call with an exception. This is a convenience method for finish_call.
Source

method finish

Flushes all background tasks to ensure they are processed. This method blocks until all currently enqueued jobs are processed, displaying a progress bar to show the status of the pending tasks. It ensures parallel processing during main thread execution and can improve performance when user code completes before data has been uploaded to the server. Args:
Source

method finish_call

Finalize a call and persist its results. Any values present in call.summary are deep-merged with computed summary statistics (e.g. usage and status counts) before being written to the database.
Source

method flush

Flushes background asynchronous tasks, safe to call multiple times.
Source

method get


Source

method get_agent_conversation_feedback

Feedback interface for an agent conversation (a session of turns).
  • use_progress_bar: Whether to display a progress bar during flush. Set to False for environments where a progress bar would not render well (e.g., CI environments).
  • callback: Optional callback function that receives status updates. Overrides use_progress_bar. Examples:

Source

method get_agent_custom_attributes

Discover typed custom-attribute keys on matching agent spans. Useful for populating filter/column pickers: returns the custom attribute keys (and their value types) seen on the selected spans. Args:
  • query: A mongo-style filter expression to restrict the spans.
  • started_after: Only consider spans started at/after this time.
  • started_before: Only consider spans started before this time.
  • limit: Maximum number of attribute keys to return.
  • offset: Number of keys to skip (for pagination). Returns: A SpanCustomAttrsSchemaResponse with attributes and has_more.
Example:

Source

method get_agent_span_feedback

Feedback interface for an agent span (one message in the Agent view). Examples:

Source

method get_agent_span_stats

Compute chart-ready aggregations over agent spans. Covers the common time-series / grouped-metric case. For numeric-bucket stats or other advanced options, call server.agent_spans_stats directly. Args:
  • start: Start of the time range (inclusive).
  • metrics: One or more metrics to aggregate (e.g. token sums).
  • end: End of the time range. Defaults to now when omitted.
  • query: A mongo-style filter expression to restrict the spans.
  • group_by: Span fields to group the aggregations by.
  • granularity: Time-bucket width in seconds for time-series stats.
  • timezone: IANA timezone used to align time buckets. Returns: A SpanStatsResponse with columns and rows.
Example:

Source

method get_agent_spans

Query agent spans for this project, optionally filtered. Returns a PaginatedIterator (like get_calls) that fetches pages as you consume it; len(...) reports the total span count. Args:
  • agent_name: If set, restrict results to this agent (a convenience shortcut for a query on the agent_name field).
  • query: A mongo-style filter expression. Combined with agent_name via $and when both are provided.
  • sort_by: Fields to sort the results by.
  • limit: Maximum number of spans to yield. None yields all.
  • offset: Number of spans to skip before yielding (for pagination).
  • page_size: Number of spans fetched per request. Returns: A PaginatedIterator over Span.
Example:

Source

method get_agent_turn

Get the structured chat view (messages) for a single turn. A turn corresponds to one trace. Args:
  • trace_id: The trace whose chat view to fetch.
  • include_feedback: If true, include feedback on the messages. Returns: An AgentTraceChatRes with the ordered messages for the turn.
Example:

Source

method get_agent_turn_feedback

Feedback interface for an agent turn (one user->agent exchange). Examples:

Source

method get_agent_turns

Get the multi-turn chat view for a conversation. Each turn corresponds to one trace. Args:
  • conversation_id: The conversation whose turns to fetch.
  • limit: Maximum number of turns to return.
  • offset: Number of most-recent turns to skip (for pagination).
  • include_feedback: If true, include feedback on the messages. Returns: A ConversationChatResponse with the ordered turns.
Example:

Source

method get_agent_versions

List versions for a single agent, with aggregated stats. Returns a PaginatedIterator (like get_calls) that fetches pages as you consume it; len(...) reports the total version count. Args:
  • agent_name: The agent whose versions to list.
  • sort_by: Fields to sort the results by.
  • limit: Maximum number of versions to yield. None yields all.
  • offset: Number of versions to skip before yielding (for pagination).
  • page_size: Number of versions fetched per request. Returns: A PaginatedIterator over Version.
Example:

Source

method get_agents

List agents in this project with aggregated stats. Returns a PaginatedIterator (like get_calls) that transparently fetches pages as you consume it; len(...) reports the total agent count, and indexing/slicing are supported. Args:
  • agent_name: If set, restrict results to this agent.
  • sort_by: Fields to sort the results by.
  • limit: Maximum number of agents to yield. None yields all.
  • offset: Number of agents to skip before yielding (for pagination).
  • page_size: Number of agents fetched per request. Returns: A PaginatedIterator over Agent.
Example:

Source

method get_aliases

Get aliases for an object version. Args:
  • obj_ref: Reference to the object version, either an ObjectRef or a weave /// URI string. Returns: List of alias strings. Includes the virtual “latest” alias if the object version is the latest.

Source

method get_annotation_queue

Read a single annotation queue by ID.
Source

method get_annotation_queue_stats

Get item completion stats for annotation queues.
Source

method get_call

Get a single call by its ID. Args:
  • call_id: The ID of the call to get.
  • include_costs: If true, cost info is included at summary.weave
  • include_feedback: If true, feedback info is included at summary.weave.feedback
  • columns: A list of columns to include in the response. If None, all columns are included. Specifying fewer columns may be more performant. Some columns are always included id, project_id, trace_id, op_name, started_at Returns: A call object.

Source

method get_calls

Retrieve a list of traced calls (operations) for this project. This method provides a powerful and flexible interface for querying trace data. It supports pagination, filtering, sorting, field projection, and scoring metadata, and can be used to power custom trace UIs or analysis tools. Performance Tip: Specify columns and use filter or query to reduce result size. Args:
  • filter: High-level filter for narrowing results by fields like op_name, parent_ids, etc.
  • limit: Maximum number of calls to return.
  • offset: Number of calls to skip before returning results (used for pagination).
  • sort_by: List of fields to sort the results by (e.g., started_at desc).
  • query: A mongo-like expression for advanced filtering. Not all Mongo operators are supported.
  • include_costs: If True, includes token/cost info in summary.weave.
  • include_feedback: If True, includes feedback in summary.weave.feedback.
  • include_storage_size: If True, includes the storage size for a call.
  • include_total_storage_size: If True, includes the total storage size for a trace.
  • include_usernames: If True, attempts to resolve each call’s wb_user_id to a wb_username.
  • columns: List of fields to return per call. Reducing this can significantly improve performance. (Some fields like id, trace_id, op_name, and started_at are always included.)
  • scored_by: Filter by one or more scorers (name or ref URI). Multiple scorers are AND-ed.
  • page_size: Number of calls fetched per page. Tune this for performance in large queries.
Returns:
  • CallsIter: An iterator over Call objects. Supports slicing, iteration, and .to_pandas().
Example:

Source

method get_evaluation

Retrieve a specific Evaluation object by its URI. Evaluation URIs typically follow the format: weave:///entity/project/object/Evaluation:version You can also get the evaluation by its “friendly” name: get_evaluation(“Evaluation:v1”) Args:
  • uri (str): The unique resource identifier of the evaluation to retrieve.
Returns:
  • Evaluation: The Evaluation object corresponding to the provided URI.
Raises:
  • TypeError: If the object at the URI is not an Evaluation instance.
  • ValueError: If the URI is invalid or the object cannot be found.
Examples:

Source

method get_evaluations

Retrieve all Evaluation objects from the current project. Returns:
  • list[Evaluation]: A list of all Evaluation objects in the current project. Empty list if no evaluations are found or if all conversions fail.
Examples:

Source

method get_feedback

Query project for feedback. Examples:
Args:
  • query: A mongo-style query expression. For convenience, also accepts a feedback UUID string.
  • reaction: For convenience, filter by a particular reaction emoji.
  • offset: The offset to start fetching feedback objects from.
  • limit: The maximum number of feedback objects to fetch. Returns: A FeedbackQuery object.

Source

method get_tags

Get tags for an object version. Args:
  • obj_ref: Reference to the object version, either an ObjectRef or a weave /// URI string. Returns: List of tag strings. Returns empty list if the object version has no tags.

Source

method get_tags_and_aliases

Get both tags and aliases for an object version in a single call. Args:
  • obj_ref: Reference to the object version, either an ObjectRef or a weave /// URI string. Returns: A tuple of (tags, aliases). Each is a list of strings. Returns empty lists if the object version has no tags or aliases.

Source
Link a published prompt version into the registry. Args:
  • prompt: A published prompt, an ObjectRef, or a fully qualified weave ///… URI string.
  • target_path: Registry destination path in the format <registry_project>/<portfolio_name>, for example wandb-registry-prompts/my-prompt-collection.
  • aliases: Optional aliases to attach to the created registry version. Returns:
  • LinkAssetToRegistryRes: Parsed response from the registry-link endpoint.

Source

method list_aliases

List all distinct aliases in the project. Returns: List of all alias strings in the project.
Source

method list_annotation_queue_items

List calls assigned to an annotation queue.
Source

method list_annotation_queues

List annotation queues for this project.
Source

method list_tags

List all distinct tags in the project. Returns: List of all tag strings in the project.
Source

method purge_costs

Purge costs from the current project. Examples:
Args:
Source

method query_costs

Query project for costs.
  • ids: The cost IDs to purge. Can be a single ID or a list of IDs. Examples:
Args:
  • query: A mongo-style query expression. For convenience, also accepts a cost UUID string.
  • llm_ids: For convenience, filter for a set of llm_ids.
  • offset: The offset to start fetching cost objects from.
  • limit: The maximum number of cost objects to fetch. Returns: A CostQuery object.

Source

method register_custom_runtime

Register a custom runtime, replacing its configuration if it exists. Runtime IDs omitted from this call are removed. String IDs use the default maximum token count; pass CustomRuntimeID to set it explicitly. Inference may use a prior configuration for up to 60 seconds after an update.
Source

method remove_aliases

Remove one or more aliases from an object. Args:
Source

method remove_tags

Remove tags from an object version.
  • obj_ref: Reference to the object, either an ObjectRef or a weave /// URI string (digest is not used since aliases are object-scoped).
  • alias: An alias name or list of alias names to remove. Args:

Source

method save

Do not call directly, use weave.publish() instead.
  • obj_ref: Reference to the object version, either an ObjectRef or a weave /// URI string.
  • tags: List of tag strings to remove. Args:
  • val: The object to save.
  • name: The name to save the object under.
  • branch: The branch to save the object under. Defaults to “latest”. Returns: A deserialized version of the saved object.

Source

method search_agents

Search agent messages by content, grouped by conversation. Searches message content (and/or the structured filters below) and returns matching conversations with their matched messages. An empty query turns this into structured retrieval over the filters. Args:
  • query: Substring to match in message content. Empty matches all.
  • agent_name: Restrict to messages from this agent.
  • conversation_id: Restrict to a single conversation.
  • trace_id: Restrict to a single trace.
  • limit: Maximum number of matching messages to consider.
  • offset: Number of matches to skip (for pagination). Returns: An AgentSearchResponse with results (matched conversations).
Example:

Source

method set_aliases

Set one or more aliases for an object version. Args:
Source

method set_wandb_run_context

Override wandb run_id and step for calls created by this client. This allows you to associate Weave calls with a specific WandB run that is not bound to the global wandb.run symbol.
  • obj_ref: Reference to the object version, either an ObjectRef or a weave /// URI string.
  • alias: An alias name or list of alias names to set (e.g., “production”). Args:
  • run_id: The run ID (not including entity/project prefix). The client will automatically add the entity/project prefix.
  • step: The step number to use for calls. If None, step will not be set. Examples:

Source

method update_annotation_queue

Update annotation queue metadata.
Source

function get_obj_name


Source

function get_parallelism_settings


Source

function map_to_refs


Source

Source

function redact_sensitive_keys


Source

function sanitize_object_name

Last modified on November 5, 2026