Skip to main content

set_current_agent_id

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.

get_current_agent_id

def get_current_agent_id():
Returns: Optional[str]: The agent ID if set, None otherwise.