@@ -318,7 +318,6 @@ from uuid import uuid4
318318
319319async def call_agent (
320320 provider : Provider, # any agent from Provider.list() call
321- user_access_token : str , # Access token obtained from OIDC provider (e.g. using authorization code OAuth flow)
322321):
323322 # 1. Create context and generate token
324323 context = await Context.create(provider_id = " your_provider_id" )
@@ -379,12 +378,6 @@ async def call_agent(
379378 }
380379 )
381380
382- # Platform API extension - token passed as auth_token
383- if platform_spec:
384- metadata |= PlatformApiExtensionClient(platform_spec).api_auth_metadata(
385- auth_token = context_token.token, expires_at = context_token.expires_at
386- )
387-
388381 # 4. Create message and run agent
389382 message = Message(
390383 message_id = str (uuid4()),
@@ -396,8 +389,8 @@ async def call_agent(
396389
397390 # 5. Execute agent run
398391 async with httpx.AsyncClient(
399- # Add user token from OIDC provider
400- headers = {" Authorization" : f " Bearer { user_access_token } " },
392+ # Add context token from before
393+ headers = {" Authorization" : f " Bearer { context_token.token.get_secret_value() } " },
401394 follow_redirects = True ,
402395 timeout = timedelta(hours = 1 ).total_seconds(),
403396 ) as httpx_client:
@@ -452,7 +445,7 @@ async def my_agent(
452445<Note >
453446 ** How it works**
454447
455- 1 . The client passes the context token via ` PlatformApiExtensionClient.api_auth_metadata() `
448+ 1 . The client passes the context token via the ` Authorization ` header
456449 2 . The ` PlatformApiExtensionServer ` receives the token and sets up the authentication context
457450 3 . All ` File ` , ` VectorStore ` , and other platform API calls automatically use this token
458451 4 . By default, context-scopeable resources are associated with the context (via ` context_id="auto" ` )
0 commit comments