MCPcopy
hub / github.com/CopilotKit/CopilotKit / set_forwarded_headers

Function set_forwarded_headers

sdk-python/copilotkit/header_propagation.py:68–75  ·  view source on GitHub ↗

Record the set of headers to forward onto outbound LLM/provider calls made later in this request context. Only ``x-*`` prefixed headers are kept; everything else is dropped.

(headers: Dict[str, str])

Source from the content-addressed store, hash-verified

66
67
68def set_forwarded_headers(headers: Dict[str, str]) -> None:
69 """Record the set of headers to forward onto outbound LLM/provider calls
70 made later in this request context.
71
72 Only ``x-*`` prefixed headers are kept; everything else is dropped.
73 """
74 filtered = {k.lower(): v for k, v in headers.items() if k.lower().startswith("x-")}
75 _forwarded_headers.set(filtered)
76
77
78def get_forwarded_headers() -> Dict[str, str]:

Calls 2

lowerMethod · 0.80
setMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…