> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-docs-1778-mysql-updates.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# op

> Python SDK reference for weave.trace.op

# API Overview

***

<a href="https://github.com/wandb/weave/blob/0.52.10/weave/trace/op.py#L1096">
  <img align="right" src="https://img.shields.io/badge/-source-cccccc?style=flat-square" />
</a>

### <kbd>function</kbd> `call`

```python theme={null}
call(
    op: 'Op',
    *args: 'Any',
    __weave: 'WeaveKwargs | None' = None,
    __should_raise: 'bool' = False,
    __require_explicit_finish: 'bool' = False,
    **kwargs: 'Any'
) → tuple[Any, Call] | Coroutine[Any, Any, tuple[Any, Call]]
```

Executes the op and returns both the result and a Call representing the execution.

This function will never raise.  Any errors are captured in the Call object.

This method is automatically bound to any function decorated with `@weave.op`, allowing for usage like:

```python theme={null}
@weave.op
def add(a: int, b: int) -> int:
     return a + b

result, call = add.call(1, 2)
```

***

<a href="https://github.com/wandb/weave/blob/0.52.10/weave/trace/op.py#L1142">
  <img align="right" src="https://img.shields.io/badge/-source-cccccc?style=flat-square" />
</a>

### <kbd>function</kbd> `calls`

```python theme={null}
calls(op: 'Op') → CallsIter
```

Get an iterator over all calls to this op.

This method is automatically bound to any function decorated with `@weave.op`, allowing for usage like:

```python theme={null}
@weave.op
def add(a: int, b: int) -> int:
     return a + b

calls = add.calls()
for call in calls:
     print(call)
```
