ms-tau-sdk 2.0.34.dev100__tar.gz → 3.0.0.dev101__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/CHANGELOG.md +68 -0
  2. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/PKG-INFO +1 -1
  3. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/pyproject.toml +1 -1
  4. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/agent_skills/tau_security_and_access/SKILL.md +7 -3
  5. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/backend/client.py +73 -7
  6. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/backend/local.py +6 -1
  7. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/backend/models.py +19 -0
  8. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/logging.py +6 -1
  9. ms_tau_sdk-3.0.0.dev101/src/ms_tau_sdk/model_relay/__init__.py +15 -0
  10. ms_tau_sdk-3.0.0.dev101/src/ms_tau_sdk/model_relay/component.py +315 -0
  11. ms_tau_sdk-3.0.0.dev101/src/ms_tau_sdk/model_relay/contract.py +458 -0
  12. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/providers/factory.py +144 -19
  13. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/runtime/manager.py +5 -0
  14. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/.gitignore +0 -0
  15. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/README.md +0 -0
  16. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/packages/tau-board/src/ms_tau_board/__init__.py +0 -0
  17. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/packages/tau-board/src/ms_tau_board/app.py +0 -0
  18. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/packages/tau-board/src/ms_tau_board/cli.py +0 -0
  19. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/packages/tau-board/src/ms_tau_board/config.py +0 -0
  20. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/packages/tau-board/src/ms_tau_board/env_file.py +0 -0
  21. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/packages/tau-board/src/ms_tau_board/logs.py +0 -0
  22. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/packages/tau-board/src/ms_tau_board/proxy.py +0 -0
  23. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/packages/tau-board/src/ms_tau_board/state.py +0 -0
  24. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/packages/tau-board/src/ms_tau_board/static/BULMA-LICENSE.txt +0 -0
  25. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/packages/tau-board/src/ms_tau_board/static/app.js +0 -0
  26. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/packages/tau-board/src/ms_tau_board/static/board.css +0 -0
  27. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/packages/tau-board/src/ms_tau_board/static/bulma.min.css +0 -0
  28. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/packages/tau-board/src/ms_tau_board/static/index.html +0 -0
  29. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/__init__.py +0 -0
  30. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/agent_skills/design-agent-icons-and-motion/SKILL.md +0 -0
  31. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/agent_skills/design-agent-icons-and-motion/agents/openai.yaml +0 -0
  32. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/agent_skills/design-agent-icons-and-motion/references/metatables-example.html +0 -0
  33. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/agent_skills/tau_a2a_runtime_adapter/SKILL.md +0 -0
  34. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/agent_skills/tau_local_development/SKILL.md +0 -0
  35. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/agent_skills/tau_project_customization/SKILL.md +0 -0
  36. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/agent_skills/tau_repository_integration/SKILL.md +0 -0
  37. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/api/__init__.py +0 -0
  38. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/api/a2a.py +0 -0
  39. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/api/chat.py +0 -0
  40. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/api/conversations.py +0 -0
  41. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/api/dependencies.py +0 -0
  42. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/api/health.py +0 -0
  43. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/api/inspection.py +0 -0
  44. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/api/local_chat.py +0 -0
  45. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/api/models.py +0 -0
  46. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/api/request_identity.py +0 -0
  47. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/api/sessions.py +0 -0
  48. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/app.py +0 -0
  49. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/application.py +0 -0
  50. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/backend/__init__.py +0 -0
  51. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/backend/assertions.py +0 -0
  52. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/backend/auth.py +0 -0
  53. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/backend/hydrate_endpoint.py +0 -0
  54. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/backend/mcp.py +0 -0
  55. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/backend/release_access.py +0 -0
  56. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/backend/release_readiness.py +0 -0
  57. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/backend/routes.py +0 -0
  58. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/backend/team_memberships.py +0 -0
  59. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/cli.py +0 -0
  60. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/errors.py +0 -0
  61. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/protocols/__init__.py +0 -0
  62. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/protocols/a2a_failure.py +0 -0
  63. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/protocols/a2a_message.py +0 -0
  64. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/protocols/a2a_roles.py +0 -0
  65. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/protocols/assistant_ui.py +0 -0
  66. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/protocols/caller_context.py +0 -0
  67. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/protocols/chat_history.py +0 -0
  68. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/protocols/strict_json.py +0 -0
  69. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/providers/__init__.py +0 -0
  70. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/providers/definitions.py +0 -0
  71. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/providers/tau_compat.py +0 -0
  72. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/resources/SYSTEM.md +0 -0
  73. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/resources/__init__.py +0 -0
  74. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/resources/context_compat.py +0 -0
  75. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/resources/loader.py +0 -0
  76. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/resources/prompts/review-code-repository.md +0 -0
  77. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/resources/selection.py +0 -0
  78. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/runtime/__init__.py +0 -0
  79. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/runtime/deployment_health.py +0 -0
  80. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/runtime/events.py +0 -0
  81. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/runtime/extensions.py +0 -0
  82. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/runtime/failures.py +0 -0
  83. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/runtime/live_turns.py +0 -0
  84. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/runtime/observability.py +0 -0
  85. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/runtime/provenance.py +0 -0
  86. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/runtime/requester.py +0 -0
  87. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/runtime/session.py +0 -0
  88. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/runtime/snapshots.py +0 -0
  89. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/runtime/task_context.py +0 -0
  90. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/sessions/__init__.py +0 -0
  91. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/sessions/storage.py +0 -0
  92. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/settings.py +0 -0
  93. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/skills.py +0 -0
  94. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/tools/__init__.py +0 -0
  95. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/tools/mainsequence_mcp.py +0 -0
  96. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/tools/mcp_applications.py +0 -0
  97. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/tools/mcp_connection.py +0 -0
  98. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/tools/skill_read.py +0 -0
  99. {ms_tau_sdk-2.0.34.dev100 → ms_tau_sdk-3.0.0.dev101}/src/ms_tau_sdk/tools/task_control.py +0 -0
@@ -1,5 +1,73 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.0 — 2026-11-13
4
+
5
+ Breaking: 3.0.0 is a hard cut with no transition and no setting to turn it off. Read the upgrade
6
+ order below before raising a `<3` range.
7
+
8
+ - **A hosted session never receives a model-provider secret.** A hosted runtime used to receive
9
+ the session owner's API key, or a sign-in's access token, and call the provider itself, so any
10
+ code in the Agent's process could copy the secret and use it anywhere until it was rotated. Now
11
+ it receives a session pass where the secret was, and the relay's address in a new
12
+ `relay_definition.base_url` beside the credential. Every model call, on all six Tau transports,
13
+ goes to the relay with the pass; the relay checks the pass, puts the real secret in and forwards
14
+ the provider's own protocol, so streaming, tool calls, thinking, images, model discovery, retries,
15
+ error handling, Organization custom providers and models Tau does not list work as before. The
16
+ pass works only at that relay and only while the run holds the session
17
+ ([ADR 0030](docs/adrs/0030-hosted-model-calls-go-through-a-relay.md)).
18
+ - **The requests announce the relay.** A hosted runtime sends `supported_model_relay_versions:
19
+ [1]` in its bootstrap and hydrate requests, and the platform refuses one that does not.
20
+ - **A hosted answer without a relay is refused.** An entry without `relay_definition`, a relayed
21
+ entry that carries `base_url` or `headers`, a relayed `openai-codex` entry without
22
+ `account_id` (a pass is not a token, so it is never decoded), a relay address the
23
+ custom-provider address checks refuse, and a refresh that moves the relay each fail the load
24
+ with a configuration error that names the field and never a value. The runtime never falls
25
+ back to calling the provider with what it received.
26
+ - **Local mode is unchanged.** It announces nothing, runs on the real credential, and refuses a
27
+ relayed answer.
28
+ - **Applications with their own hydrate endpoint serve a relay.** A custom hydrate endpoint
29
+ (ADR 0027) must answer hosted runtimes a pass and its own relay address too. The new
30
+ `ms_tau_sdk.model_relay` is that relay as a FastAPI router: the application says who a pass
31
+ belongs to and the provider, address and secret for that session, and the router does the
32
+ rest exactly as the platform's relay does. `ms_tau_sdk.model_relay.contract` publishes the
33
+ relay contract as cases that the SDK's router passes and any other relay can run. See the
34
+ [public API](docs/reference/public-api.md#ms_tau_sdkmodel_relay).
35
+ - **A `key` in a logged URL is redacted.** Google's transport sends its key, and now the pass, as
36
+ a query parameter, and httpx's request line put it in the runtime's logs. The log sanitizer
37
+ now replaces a `key` query value with `[REDACTED]`, for every logger.
38
+
39
+ - **Anthropic-protocol providers are called under `/v1`.** For `anthropic`, `minimax`,
40
+ `minimax-cn`, `fireworks`, `vercel-ai-gateway` and GitHub Copilot's Claude models the runtime
41
+ called `<address>/messages`, for example `https://api.anthropic.com/messages`, which no provider
42
+ serves: Tau's catalog addresses for this protocol carry no `/v1`, Tau's own configuration
43
+ appends it, and the SDK did not. Now the SDK appends `/v1` unless the address already ends in
44
+ it, in local mode and through the relay, where the call is `<relay>/v1/messages`. Found by
45
+ capturing the request; nothing was called against a provider.
46
+
47
+ - **Anthropic and GitHub Copilot sign-ins are sent as Tau sends them.** The SDK sent every
48
+ sign-in other than `openai-codex` as if its token were an API key. Now, in local mode and
49
+ through the relay:
50
+ - an Anthropic sign-in goes as `Authorization: Bearer`, never `x-api-key`, with Tau's sign-in
51
+ headers (`anthropic-beta: claude-code-20250219,oauth-2025-04-20`, `user-agent`, `x-app`) and
52
+ the first system block Anthropic requires of a sign-in. An Anthropic API key is sent as
53
+ before;
54
+ - a GitHub Copilot sign-in carries Tau's Copilot headers on every call, and its Claude models
55
+ go as a bearer token. In local mode the address is the one the Copilot token names
56
+ (`proxy-ep`), and only a host under `githubcopilot.com` is accepted, because a saved sign-in
57
+ can be shared and its token must not choose where a conversation goes; in a hosted session it is the relay's,
58
+ nothing is read out of the pass, and the relay derives the account's address from the real
59
+ token;
60
+ - a refreshed sign-in is used from the next request, with its new token and address.
61
+
62
+ Tau's one-hour prompt-cache retention for sign-ins is not carried over; requests keep the
63
+ default retention. Checked against captured requests only: no call was made to Anthropic or
64
+ GitHub, and no such sign-in is configured on the development platform.
65
+
66
+ Upgrade order: the platform's relay first, then each application with its own hydrate endpoint
67
+ ships its relay, then hosted runtimes upgrade to 3.0.0. A 2.x hosted runtime cannot start a
68
+ session on a platform that relays, and a 3.0.0 hosted runtime cannot start one on a platform or
69
+ endpoint that does not. Nothing here was tried against a deployed relay.
70
+
3
71
  ## 2.0.34 — 2026-11-13
4
72
 
5
73
  - **A hydrated credential no longer moves a provider Tau knows.** For a provider in Tau's
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: ms-tau-sdk
3
- Version: 2.0.34.dev100
3
+ Version: 3.0.0.dev101
4
4
  Summary: Workspace-bound Tau application primitives for Main Sequence projects
5
5
  Project-URL: Changelog, https://github.com/mainsequence-sdk/ms-tau-sdk/blob/development/CHANGELOG.md
6
6
  Project-URL: Documentation, https://github.com/mainsequence-sdk/ms-tau-sdk/tree/development/docs
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "ms-tau-sdk"
7
- version = "2.0.34.dev100"
7
+ version = "3.0.0.dev101"
8
8
  description = "Workspace-bound Tau application primitives for Main Sequence projects"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.13"
@@ -236,9 +236,13 @@ directly or through a team:
236
236
  with the `granting_policies` that would allow it.
237
237
 
238
238
  Holding `user` delivers the credential, or the endpoint's stored authentication, to the holder's own
239
- runtime, including local Tau, where it can be copied; removing the policy stops later deliveries,
240
- not copies already made. To let a team run an Agent on one credential, its owner gives the team
241
- `user`.
239
+ local Tau, where it can be copied; removing the policy stops later deliveries, not copies already
240
+ made. To let a team run an Agent on one credential, its owner gives the team `user`.
241
+
242
+ From ms-tau-sdk 3.0.0 a hosted session never receives the secret: it receives a session pass and a
243
+ relay address, and every model call goes through the relay, which holds the secret. The pass works
244
+ only at that relay and only while the run holds the session. An application with its own hydrate
245
+ endpoint serves its relay with `ms_tau_sdk.model_relay` (ADR 0030).
242
246
 
243
247
  ## Agents
244
248
 
@@ -36,6 +36,7 @@ from .hydrate_endpoint import (
36
36
  ReleaseHydrateEndpoint,
37
37
  )
38
38
  from .models import (
39
+ MODEL_RELAY_VERSION,
39
40
  AgentCardEnvelope,
40
41
  AgentSession,
41
42
  AgentTask,
@@ -260,6 +261,15 @@ class MainSequenceClient:
260
261
  )
261
262
  return None
262
263
 
264
+ @property
265
+ def relays_model_calls(self) -> bool:
266
+ """Whether this runtime's sessions call models only through a relay (ADR 0030).
267
+
268
+ A hosted runtime announces the relay in its bootstrap and hydrate requests and accepts
269
+ only a relayed credential. Local mode announces nothing and runs on the real credential.
270
+ """
271
+ return not self.settings.local_mode
272
+
263
273
  def _hydrate_http_client(self) -> httpx.AsyncClient:
264
274
  if self._hydrate_http is None:
265
275
  self._hydrate_http = httpx.AsyncClient(
@@ -954,6 +964,8 @@ class MainSequenceClient:
954
964
  "supported_provider_control_schema_versions": [1],
955
965
  "execution_selection": {"provider": provider, "model": model},
956
966
  }
967
+ if self.relays_model_calls:
968
+ payload["supported_model_relay_versions"] = [MODEL_RELAY_VERSION]
957
969
  if custom_id is not None:
958
970
  payload["custom_id"] = custom_id
959
971
  evidence = await self._hydrate(provider, model=model, payload=payload)
@@ -1013,8 +1025,13 @@ class MainSequenceClient:
1013
1025
  model: str,
1014
1026
  payload: Mapping[str, Any],
1015
1027
  ) -> ProviderExecutionEvidence:
1016
- """Post one hydrate body to tdag-django, or to the custom endpoint when one is set."""
1028
+ """Post one hydrate body to tdag-django, or to the custom endpoint when one is set.
1017
1029
 
1030
+ A body that announces the model relay accepts only a relayed answer, and one that does
1031
+ not accepts none (ADR 0030).
1032
+ """
1033
+
1034
+ relayed = MODEL_RELAY_VERSION in payload.get("supported_model_relay_versions", ())
1018
1035
  if self._hydrate_endpoint is None:
1019
1036
  data = await self._request(
1020
1037
  "POST",
@@ -1022,9 +1039,9 @@ class MainSequenceClient:
1022
1039
  json=payload,
1023
1040
  idempotent=True,
1024
1041
  )
1025
- return self._provider_evidence(provider, data)
1042
+ return self._provider_evidence(provider, data, relayed=relayed, source="Backend")
1026
1043
  data = await self._hydrate_endpoint.hydrate(payload)
1027
- return self._custom_provider_evidence(provider, model=model, data=data)
1044
+ return self._custom_provider_evidence(provider, model=model, data=data, relayed=relayed)
1028
1045
 
1029
1046
  def _custom_provider_evidence(
1030
1047
  self,
@@ -1032,6 +1049,7 @@ class MainSequenceClient:
1032
1049
  *,
1033
1050
  model: str,
1034
1051
  data: Mapping[str, Any],
1052
+ relayed: bool,
1035
1053
  ) -> ProviderExecutionEvidence:
1036
1054
  """Check a custom endpoint's answer against tdag-django's contract (ADR 0027, section 3).
1037
1055
 
@@ -1059,7 +1077,7 @@ class MainSequenceClient:
1059
1077
  evidence: ProviderExecutionEvidence | None = None
1060
1078
  invalid_fields: list[str] = []
1061
1079
  try:
1062
- evidence = self._provider_evidence(provider, data)
1080
+ evidence = self._provider_evidence(provider, data, relayed=relayed, source=source)
1063
1081
  except ValidationError as error:
1064
1082
  invalid_fields = sorted(
1065
1083
  {".".join(str(part) for part in item["loc"]) for item in error.errors()}
@@ -1076,7 +1094,14 @@ class MainSequenceClient:
1076
1094
  )
1077
1095
  return evidence
1078
1096
 
1079
- def _provider_evidence(self, provider: str, data: object) -> ProviderExecutionEvidence:
1097
+ def _provider_evidence(
1098
+ self,
1099
+ provider: str,
1100
+ data: object,
1101
+ *,
1102
+ relayed: bool,
1103
+ source: str,
1104
+ ) -> ProviderExecutionEvidence:
1080
1105
  if not isinstance(data, dict):
1081
1106
  raise BackendError("Backend provider hydration response is invalid")
1082
1107
  try:
@@ -1086,7 +1111,12 @@ class MainSequenceClient:
1086
1111
  "Backend provider hydration omitted valid provider-control evidence"
1087
1112
  ) from error
1088
1113
  return ProviderExecutionEvidence(
1089
- credential=self.provider_credential_from_hydration(provider, data),
1114
+ credential=self.provider_credential_from_hydration(
1115
+ provider,
1116
+ data,
1117
+ relayed=relayed,
1118
+ source=source,
1119
+ ),
1090
1120
  provider_control=provider_control,
1091
1121
  )
1092
1122
 
@@ -1094,7 +1124,17 @@ class MainSequenceClient:
1094
1124
  def provider_credential_from_hydration(
1095
1125
  provider: str,
1096
1126
  data: object,
1127
+ *,
1128
+ relayed: bool = False,
1129
+ source: str = "Backend",
1097
1130
  ) -> ProviderCredential:
1131
+ """Parse one hydrated credential entry.
1132
+
1133
+ ``relayed`` says that the runtime announced the model relay, so the entry must be the
1134
+ relayed one of ADR 0030: a session pass beside a ``relay_definition``, with no address or
1135
+ headers. Without it the entry must carry no ``relay_definition``. An error names fields,
1136
+ never their values.
1137
+ """
1098
1138
  credentials = data.get("credentials", {}) if isinstance(data, dict) else {}
1099
1139
  hydrated = credentials.get(provider)
1100
1140
  if not isinstance(hydrated, dict):
@@ -1105,7 +1145,32 @@ class MainSequenceClient:
1105
1145
  credential_kind = str(hydrated.get("credential_kind") or raw.get("type") or "api_key")
1106
1146
  access_token = raw.get("access_token") or raw.get("access")
1107
1147
  account_id = raw.get("account_id")
1108
- if provider == "openai-codex" and isinstance(access_token, str) and not account_id:
1148
+ relay_definition = hydrated.get("relay_definition")
1149
+ if relayed:
1150
+ relay_base_url = (
1151
+ relay_definition.get("base_url") if isinstance(relay_definition, dict) else None
1152
+ )
1153
+ if not isinstance(relay_base_url, str) or not relay_base_url.strip():
1154
+ raise ConfigurationError(
1155
+ f"{source} answered no relay_definition for {provider}: a hosted session "
1156
+ "calls models only through the model relay"
1157
+ )
1158
+ if raw.get("base_url") is not None or raw.get("headers"):
1159
+ raise ConfigurationError(
1160
+ f"{source} answered a relayed credential for {provider} with base_url or "
1161
+ "headers"
1162
+ )
1163
+ # A pass is not a token: the account id is never read out of it.
1164
+ if provider == "openai-codex" and not account_id:
1165
+ raise ConfigurationError(
1166
+ f"{source} answered a relayed openai-codex credential without account_id"
1167
+ )
1168
+ elif relay_definition is not None:
1169
+ raise ConfigurationError(
1170
+ f"{source} answered relay_definition for {provider} to a runtime that does not "
1171
+ "call models through the model relay"
1172
+ )
1173
+ elif provider == "openai-codex" and isinstance(access_token, str) and not account_id:
1109
1174
  account_id = account_id_from_access_token(access_token)
1110
1175
  return ProviderCredential.model_validate(
1111
1176
  {
@@ -1124,6 +1189,7 @@ class MainSequenceClient:
1124
1189
  "api": raw.get("api"),
1125
1190
  # Server-owned, beside the saved credential and never inside it.
1126
1191
  "catalog_definition": hydrated.get("catalog_definition"),
1192
+ "relay_definition": relay_definition,
1127
1193
  "metadata": {
1128
1194
  "version": hydrated.get("version"),
1129
1195
  "credential_hash": hydrated.get("credential_hash"),
@@ -3816,5 +3816,10 @@ class LocalDevelopmentBackend(MainSequenceClient):
3816
3816
  def provider_credential_from_hydration(
3817
3817
  provider: str,
3818
3818
  data: object,
3819
+ *,
3820
+ relayed: bool = False,
3821
+ source: str = "Backend",
3819
3822
  ) -> ProviderCredential:
3820
- return MainSequenceClient.provider_credential_from_hydration(provider, data)
3823
+ return MainSequenceClient.provider_credential_from_hydration(
3824
+ provider, data, relayed=relayed, source=source
3825
+ )
@@ -43,6 +43,10 @@ type AgentTaskStatus = Literal[
43
43
  type A2ATaskMessage = dict[str, Any]
44
44
 
45
45
 
46
+ # The model relay contract version a hosted runtime announces (ADR 0030).
47
+ MODEL_RELAY_VERSION = 1
48
+
49
+
46
50
  class BackendModel(BaseModel):
47
51
  model_config = ConfigDict(extra="allow", populate_by_name=True)
48
52
 
@@ -358,6 +362,9 @@ class TauRuntimeBootstrapRequest(BackendRequestModel):
358
362
  # A runtime that lists a version applies the Agent's `runtime_resources` (ADR 0026). The
359
363
  # platform refuses to bootstrap an Agent that declares a selection for any other runtime.
360
364
  supported_runtime_resources_schema_versions: list[int] = Field(default_factory=lambda: [1])
365
+ # A hosted runtime lists MODEL_RELAY_VERSION and calls models only through the relay
366
+ # (ADR 0030). The platform refuses a hosted runtime that does not; local mode lists none.
367
+ supported_model_relay_versions: list[int] = Field(default_factory=list)
361
368
  tau_runtime_version: str
362
369
 
363
370
 
@@ -454,6 +461,16 @@ class ProviderCatalogDefinition(BackendModel):
454
461
  compat: dict[str, Any] = Field(default_factory=dict)
455
462
 
456
463
 
464
+ class ModelRelayDefinition(BackendModel):
465
+ """Where a hosted runtime sends its model calls, beside a relayed credential (ADR 0030).
466
+
467
+ The credential then holds a session pass, never a provider secret. Each Tau transport appends
468
+ its own path to ``base_url``.
469
+ """
470
+
471
+ base_url: str
472
+
473
+
457
474
  class ProviderCredential(BackendModel):
458
475
  provider: str
459
476
  custom_id: str | None = None
@@ -471,6 +488,8 @@ class ProviderCredential(BackendModel):
471
488
  # in repr() or str().
472
489
  headers: dict[str, str] = Field(default_factory=dict, repr=False)
473
490
  catalog_definition: ProviderCatalogDefinition | None = None
491
+ # Server-owned, beside the credential: present exactly when the credential is a session pass.
492
+ relay_definition: ModelRelayDefinition | None = None
474
493
  metadata: dict[str, Any] = Field(default_factory=dict)
475
494
 
476
495
  def secret(self) -> str:
@@ -64,6 +64,9 @@ SENSITIVE_EXACT_KEYS = {
64
64
  "user_agent",
65
65
  }
66
66
  BEARER_PATTERN = re.compile(r"(?i)\bbearer\s+(?!bearer\b)[A-Za-z0-9._~+/=-]+")
67
+ # Google's transport sends its key, and in a hosted session the relay pass, as a query parameter,
68
+ # so a logged request URL such as httpx's request line would carry it (ADR 0030).
69
+ KEY_QUERY_PATTERN = re.compile(r"(?i)([?&]key=)(?!\[REDACTED\])[^&#\s\"'()]+")
67
70
  CALLSITE_PARAMETERS = {
68
71
  structlog.processors.CallsiteParameter.PATHNAME,
69
72
  structlog.processors.CallsiteParameter.FILENAME,
@@ -139,7 +142,9 @@ def _sanitize(value: object, *, key: str = "") -> object:
139
142
  if isinstance(value, list | tuple | set):
140
143
  return [_sanitize(child) for child in value]
141
144
  if isinstance(value, str):
142
- return BEARER_PATTERN.sub("Bearer [REDACTED]", value)
145
+ return KEY_QUERY_PATTERN.sub(
146
+ r"\1[REDACTED]", BEARER_PATTERN.sub("Bearer [REDACTED]", value)
147
+ )
143
148
  return value
144
149
 
145
150
 
@@ -0,0 +1,15 @@
1
+ """The model relay component for applications with their own hydrate endpoint (ADR 0030)."""
2
+
3
+ from .component import (
4
+ RELAY_PATHS,
5
+ RelayRefused,
6
+ RelayUpstream,
7
+ create_model_relay_router,
8
+ )
9
+
10
+ __all__ = [
11
+ "RELAY_PATHS",
12
+ "RelayRefused",
13
+ "RelayUpstream",
14
+ "create_model_relay_router",
15
+ ]