Skip to content

[python-client] Add conversation-scoped tokens to the Python client - #86

Merged
gmtuca merged 2 commits into
mainfrom
conv-scoped-tokens
Oct 17, 2025
Merged

[python-client] Add conversation-scoped tokens to the Python client#86
gmtuca merged 2 commits into
mainfrom
conv-scoped-tokens

Conversation

@gmtuca

@gmtuca gmtuca commented Oct 17, 2025

Copy link
Copy Markdown
Contributor

No description provided.

SCHEME = "v1"
LEEWAY = timedelta(minutes=5)

SIGNATURE_HEADER_NAME = "X-GradientLabs-Signature"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somewhat weirdly, in our Python client, we assume the company can extract HTTP headers. We don't do this ourselves (unlike in the Go client where we extract the header ourselves).

Anyway, let's at least give them the header names!

attachments: Optional[List[Attachment]] = None

# conversation_token is the raw sensitive token that can be optionally provided in every message.
# The latest token of the conversation will be echoed back in future Webhooks, under the header `X-GradientLabs-Token`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could also be worth mentioning that they can be returned in HTTP tool calls too if they use templating?

Same applies for the other comment below

@gmtuca
gmtuca merged commit e5298c2 into main Oct 17, 2025
1 check passed
@gmtuca
gmtuca deleted the conv-scoped-tokens branch October 17, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants