> ## 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.agent context

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

<a id="camel.utils.agent_context.set_current_agent_id" />

## set\_current\_agent\_id

```python theme={"system"}
def set_current_agent_id(agent_id: str):
```

Set the current agent ID 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:**

* **agent\_id** (str): The agent ID to set.

<a id="camel.utils.agent_context.get_current_agent_id" />

## get\_current\_agent\_id

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

**Returns:**

Optional\[str]: The agent ID if set, None otherwise.
