> ## Documentation Index
> Fetch the complete documentation index at: https://docs.camel-ai.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Camel.utils.langfuse

<a id="camel.utils.langfuse" />

<a id="camel.utils.langfuse.configure_langfuse" />

## configure\_langfuse

```python theme={"system"}
def configure_langfuse(
    public_key: Optional[str] = None,
    secret_key: Optional[str] = None,
    host: Optional[str] = None,
    debug: Optional[bool] = None,
    enabled: Optional[bool] = None
):
```

Configure Langfuse for CAMEL models.

**Parameters:**

* **public\_key** (Optional\[str]): Langfuse public key. Can be set via LANGFUSE\_PUBLIC\_KEY. (default: :obj:`None`)
* **secret\_key** (Optional\[str]): Langfuse secret key. Can be set via LANGFUSE\_SECRET\_KEY. (default: :obj:`None`)
* **host** (Optional\[str]): Langfuse host URL. Can be set via LANGFUSE\_HOST. (default: :obj:`https://cloud.langfuse.com`)
* **debug** (Optional\[bool]): Enable debug mode. Can be set via LANGFUSE\_DEBUG. (default: :obj:`None`)
* **enabled** (Optional\[bool]): Enable/disable tracing. Can be set via LANGFUSE\_ENABLED. (default: :obj:`None`)

**Note:**

This function configures the native langfuse\_context which works with
@observe() decorators. Set enabled=False to disable all tracing.

<a id="camel.utils.langfuse.is_langfuse_available" />

## is\_langfuse\_available

```python theme={"system"}
def is_langfuse_available():
```

Check if Langfuse is configured.

<a id="camel.utils.langfuse.set_current_agent_session_id" />

## set\_current\_agent\_session\_id

```python theme={"system"}
def set_current_agent_session_id(session_id: str):
```

Set the session ID for the current agent in context-local storage.

This is safe to use in both sync and async contexts.
In async contexts, each coroutine maintains its own value.

**Parameters:**

* **session\_id** (str): The session ID to set for the current agent.

<a id="camel.utils.langfuse.get_current_agent_session_id" />

## get\_current\_agent\_session\_id

```python theme={"system"}
def get_current_agent_session_id():
```

**Returns:**

Optional\[str]: The session ID for the current agent.

<a id="camel.utils.langfuse.update_langfuse_trace" />

## update\_langfuse\_trace

```python theme={"system"}
def update_langfuse_trace(
    session_id: Optional[str] = None,
    user_id: Optional[str] = None,
    metadata: Optional[Dict[str, Any]] = None,
    tags: Optional[List[str]] = None
):
```

Update the current Langfuse trace with session ID and metadata.

**Parameters:**

* **session\_id** (Optional\[str]): Optional session ID to use. If :obj:`None` uses the current agent's session ID. (default: :obj:`None`)
* **user\_id** (Optional\[str]): Optional user ID for the trace. (default: :obj:`None`)
* **metadata** (Optional\[Dict\[str, Any]]): Optional metadata dictionary. (default: :obj:`None`)
* **tags** (Optional\[List\[str]]): Optional list of tags. (default: :obj:`None`)

**Returns:**

bool: True if update was successful, False otherwise.

<a id="camel.utils.langfuse.update_current_observation" />

## update\_current\_observation

```python theme={"system"}
def update_current_observation(
    input: Optional[Dict[str, Any]] = None,
    output: Optional[Dict[str, Any]] = None,
    model: Optional[str] = None,
    model_parameters: Optional[Dict[str, Any]] = None,
    usage_details: Optional[Dict[str, Any]] = None,
    **kwargs
):
```

Update the current Langfuse observation with input, output,
model, model\_parameters, and usage\_details.

**Parameters:**

* **input** (Optional\[Dict\[str, Any]]): Optional input dictionary. (default: :obj:`None`)
* **output** (Optional\[Dict\[str, Any]]): Optional output dictionary. (default: :obj:`None`)
* **model** (Optional\[str]): Optional model name. (default: :obj:`None`)
* **model\_parameters** (Optional\[Dict\[str, Any]]): Optional model parameters dictionary. (default: :obj:`None`)
* **usage\_details** (Optional\[Dict\[str, Any]]): Optional usage details dictionary. (default: :obj:`None`)

**Returns:**

None

<a id="camel.utils.langfuse.get_langfuse_status" />

## get\_langfuse\_status

```python theme={"system"}
def get_langfuse_status():
```

**Returns:**

Dict\[str, Any]: Status information including configuration state.

<a id="camel.utils.langfuse.observe" />

## observe

```python theme={"system"}
def observe(*args, **kwargs):
```
