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

# Set Branch • AI Agent SDK

> set_branch: Set current branch context for parallel execution tracking.

# set\_branch

<div className="flex items-center gap-2">
  <Badge color="purple">Method</Badge>
</div>

> This is a method of the [**ContextTraceEmitter**](../classes/ContextTraceEmitter) class in the [**context\_events**](../modules/context_events) module.

Set current branch context for parallel execution tracking.

All subsequent events will include this branch\_id until cleared.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def set_branch(branch_id: str) -> None
```

## Parameters

<ParamField query="branch_id" type="str" required={true}>
  Identifier for the parallel branch (e.g., 'parallel\_0', 'loop\_5')
</ParamField>

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/trace/context_events.py#L420">
  `praisonaiagents/trace/context_events.py` at line 420
</Card>
