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

# Extract Carrier • AI Agent SDK

> extract_carrier: Return a propagation carrier extracted from inbound ``carrier``.

# extract\_carrier

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

> This is a method of the [**GatewayTraceHook**](../classes/GatewayTraceHook) class in the [**protocols**](../modules/protocols) module.

Return a propagation carrier extracted from inbound `carrier`.

Reads W3C trace-context (`traceparent`/`tracestate`) from an
inbound header mapping and returns a normalized carrier suitable to pass
as `stage(..., parent_carrier=...)`, or `None` when no usable
context is present. A no-op returning `None` when no exporter is
attached.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def extract_carrier(carrier: 'Mapping[str, str]') -> 'Optional[Mapping[str, str]]'
```

## Parameters

<ParamField query="carrier" type="'Mapping[str, str]'" required={true}>
  No description available.
</ParamField>

### Returns

<ResponseField name="Returns" type="'Optional[Mapping[str, str]]'">
  The result of the operation.
</ResponseField>

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L5237">
  `praisonaiagents/gateway/protocols.py` at line 5237
</Card>
