trytilde 3.1.0__tar.gz → 3.1.1__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 (138) hide show
  1. {trytilde-3.1.0 → trytilde-3.1.1}/.gitignore +2 -0
  2. {trytilde-3.1.0 → trytilde-3.1.1}/PKG-INFO +14 -4
  3. {trytilde-3.1.0 → trytilde-3.1.1}/README.md +12 -3
  4. {trytilde-3.1.0 → trytilde-3.1.1}/pyproject.toml +7 -1
  5. trytilde-3.1.1/src/tilde/__main__.py +12 -0
  6. trytilde-3.1.0/src/tilde/deploy.py → trytilde-3.1.1/src/tilde/declarations.py +26 -121
  7. trytilde-3.1.0/src/tilde/__main__.py +0 -9
  8. {trytilde-3.1.0 → trytilde-3.1.1}/hatch_build.py +0 -0
  9. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/__init__.py +0 -0
  10. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/_cancel.py +0 -0
  11. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/_inference.py +0 -0
  12. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/_invocation.py +0 -0
  13. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/_otlp.py +0 -0
  14. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/_tools.py +0 -0
  15. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/_transport.py +0 -0
  16. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/agent_event_ingress/__init__.py +0 -0
  17. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/agent_event_ingress/v1/__init__.py +0 -0
  18. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/agent_event_ingress/v1/sidecars_connect.py +0 -0
  19. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/agent_event_ingress/v1/sidecars_pb2.py +0 -0
  20. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/agent_event_ingress/v1/sidecars_pb2.pyi +0 -0
  21. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/agent_host/__init__.py +0 -0
  22. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/agent_host/v1/__init__.py +0 -0
  23. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/agent_host/v1/agent_pb2.py +0 -0
  24. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/agent_host/v1/agent_pb2.pyi +0 -0
  25. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/channels.py +0 -0
  26. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/chat_proxy.py +0 -0
  27. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/clients.py +0 -0
  28. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/context.py +0 -0
  29. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/discovery.py +0 -0
  30. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/fastapi.py +0 -0
  31. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/host.py +0 -0
  32. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/logging.py +0 -0
  33. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/__init__.py +0 -0
  34. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/__init__.py +0 -0
  35. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/access_connect.py +0 -0
  36. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/access_pb2.py +0 -0
  37. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/access_pb2.pyi +0 -0
  38. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/agents_connect.py +0 -0
  39. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/agents_pb2.py +0 -0
  40. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/agents_pb2.pyi +0 -0
  41. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/connections_connect.py +0 -0
  42. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/connections_pb2.py +0 -0
  43. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/connections_pb2.pyi +0 -0
  44. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/deployments_connect.py +0 -0
  45. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/deployments_pb2.py +0 -0
  46. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/deployments_pb2.pyi +0 -0
  47. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/identities_connect.py +0 -0
  48. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/identities_pb2.py +0 -0
  49. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/identities_pb2.pyi +0 -0
  50. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/inference_connect.py +0 -0
  51. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/inference_pb2.py +0 -0
  52. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/inference_pb2.pyi +0 -0
  53. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/logs_connect.py +0 -0
  54. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/logs_pb2.py +0 -0
  55. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/logs_pb2.pyi +0 -0
  56. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/prompts_connect.py +0 -0
  57. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/prompts_pb2.py +0 -0
  58. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/prompts_pb2.pyi +0 -0
  59. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/skills_connect.py +0 -0
  60. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/skills_pb2.py +0 -0
  61. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/skills_pb2.pyi +0 -0
  62. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/tilde_chat_connect.py +0 -0
  63. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/tilde_chat_pb2.py +0 -0
  64. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/tilde_chat_pb2.pyi +0 -0
  65. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/tools_connect.py +0 -0
  66. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/tools_pb2.py +0 -0
  67. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/tools_pb2.pyi +0 -0
  68. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/tracing_connect.py +0 -0
  69. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/tracing_pb2.py +0 -0
  70. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/management/v1/tracing_pb2.pyi +0 -0
  71. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/messages.py +0 -0
  72. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/prompts.py +0 -0
  73. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/provider/__init__.py +0 -0
  74. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/provider/tilde/__init__.py +0 -0
  75. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/provider/tilde/v1/__init__.py +0 -0
  76. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/provider/tilde/v1/chat_connect.py +0 -0
  77. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/provider/tilde/v1/chat_pb2.py +0 -0
  78. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/provider/tilde/v1/chat_pb2.pyi +0 -0
  79. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/provider/v1/__init__.py +0 -0
  80. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/provider/v1/connections_connect.py +0 -0
  81. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/provider/v1/connections_pb2.py +0 -0
  82. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/provider/v1/connections_pb2.pyi +0 -0
  83. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/run/__init__.py +0 -0
  84. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/run/v1/__init__.py +0 -0
  85. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/run/v1/run_connect.py +0 -0
  86. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/run/v1/run_pb2.py +0 -0
  87. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/run/v1/run_pb2.pyi +0 -0
  88. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/runtime/__init__.py +0 -0
  89. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/runtime/v1/__init__.py +0 -0
  90. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/runtime/v1/agents_connect.py +0 -0
  91. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/runtime/v1/agents_pb2.py +0 -0
  92. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/runtime/v1/agents_pb2.pyi +0 -0
  93. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/runtime/v1/cache_pb2.py +0 -0
  94. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/runtime/v1/cache_pb2.pyi +0 -0
  95. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/runtime/v1/chat_connect.py +0 -0
  96. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/runtime/v1/chat_pb2.py +0 -0
  97. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/runtime/v1/chat_pb2.pyi +0 -0
  98. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/runtime/v1/controls_connect.py +0 -0
  99. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/runtime/v1/controls_pb2.py +0 -0
  100. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/runtime/v1/controls_pb2.pyi +0 -0
  101. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/runtime/v1/prompts_connect.py +0 -0
  102. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/runtime/v1/prompts_pb2.py +0 -0
  103. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/runtime/v1/prompts_pb2.pyi +0 -0
  104. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/runtime/v1/skills_connect.py +0 -0
  105. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/runtime/v1/skills_pb2.py +0 -0
  106. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/runtime/v1/skills_pb2.pyi +0 -0
  107. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/setup/__init__.py +0 -0
  108. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/setup/v1/__init__.py +0 -0
  109. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/setup/v1/connections_connect.py +0 -0
  110. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/setup/v1/connections_pb2.py +0 -0
  111. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/setup/v1/connections_pb2.pyi +0 -0
  112. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/setup/v1/identity_verification_connect.py +0 -0
  113. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/setup/v1/identity_verification_pb2.py +0 -0
  114. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/setup/v1/identity_verification_pb2.pyi +0 -0
  115. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/skills.py +0 -0
  116. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/tool_host/v1/tool_host_connect.py +0 -0
  117. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/tool_host/v1/tool_host_pb2.py +0 -0
  118. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/tool_host/v1/tool_host_pb2.pyi +0 -0
  119. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/tool_hosts.py +0 -0
  120. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/tracing.py +0 -0
  121. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/types/__init__.py +0 -0
  122. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/types/v1/__init__.py +0 -0
  123. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/types/v1/access_pb2.py +0 -0
  124. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/types/v1/access_pb2.pyi +0 -0
  125. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/types/v1/agent_pb2.py +0 -0
  126. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/types/v1/agent_pb2.pyi +0 -0
  127. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/types/v1/chat_pb2.py +0 -0
  128. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/types/v1/chat_pb2.pyi +0 -0
  129. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/types/v1/connections_pb2.py +0 -0
  130. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/types/v1/connections_pb2.pyi +0 -0
  131. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/types/v1/deployment_pb2.py +0 -0
  132. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/types/v1/deployment_pb2.pyi +0 -0
  133. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/types/v1/prompt_pb2.py +0 -0
  134. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/types/v1/prompt_pb2.pyi +0 -0
  135. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/types/v1/runtime_event_pb2.py +0 -0
  136. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/types/v1/runtime_event_pb2.pyi +0 -0
  137. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/types/v1/skill_pb2.py +0 -0
  138. {trytilde-3.1.0 → trytilde-3.1.1}/src/tilde/types/v1/skill_pb2.pyi +0 -0
@@ -21,6 +21,8 @@ __pycache__/
21
21
 
22
22
  # Local runtime credentials must not enter the initial repository commit.
23
23
  /.env
24
+ # The quickstart tells you to put an encryption key here; never commit it.
25
+ /quickstart/.env
24
26
  log
25
27
 
26
28
  /.local/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: trytilde
3
- Version: 3.1.0
3
+ Version: 3.1.1
4
4
  Summary: Tilde agent SDK for Python: dial-in agent hosts, invocation context, channel tools, FastAPI integration and the chat proxy
5
5
  License-Expression: Apache-2.0
6
6
  Requires-Python: >=3.11
@@ -12,6 +12,7 @@ Requires-Dist: opentelemetry-sdk>=1.30
12
12
  Requires-Dist: protobuf>=5.29
13
13
  Requires-Dist: pydantic>=2.7
14
14
  Requires-Dist: pyqwest>=0.5
15
+ Requires-Dist: trytilde-cli==3.1.1
15
16
  Provides-Extra: fastapi
16
17
  Requires-Dist: fastapi>=0.115; extra == 'fastapi'
17
18
  Description-Content-Type: text/markdown
@@ -181,19 +182,28 @@ the next invocation without a redeploy. Frameworks without native skills convert
181
182
  their instructions. Framework adapters stamp dynamic prompts with
182
183
  `ctx.activate_prompt(name, hash)`.
183
184
 
184
- Prompts and skills are registered with a deployment:
185
+ Prompts and skills are registered with a deployment by the [Tilde CLI](https://trytilde.ai/docs/cli),
186
+ which this package asks for at its own version, so `uv run tilde` is the matching build:
185
187
 
186
188
  ```sh
187
- python -m tilde deploy [ENTRY] [--agent-id ID] [--url URL] [--api-key KEY] \
189
+ uv run tilde dev # register, run and chat with the agent locally
190
+ uv run tilde deploy [ENTRY] [--agent-id ID] [--url URL] [--api-key KEY] \
188
191
  [--target gateway|sidecar|lambda] [--function-arn ARN] [--external-id ID] [--label L] \
189
192
  [--dry-run] [--json]
190
193
  ```
191
194
 
195
+ The CLI reads what the code declares through this package's own entrypoint, which prints the
196
+ `DeploymentDeclarations` JSON and contacts nothing:
197
+
198
+ ```sh
199
+ tilde-declarations [ENTRY] [--allow-empty] # or: python -m tilde declarations [ENTRY]
200
+ ```
201
+
192
202
  `ENTRY` is a file or dotted module (default `main.py`), imported with `TILDE_DISCOVERY=1`
193
203
  (`connect_agent`/`run_connected_agent` then do nothing) and not as `__main__`. The globals of
194
204
  the entry and of every module loaded from the working directory are scanned for `define_*`
195
205
  objects and offered to framework discoverers (entry point group `tilde.discover`, for example
196
- `trytilde-crewai`). The inventory goes to stderr; `--dry-run` prints the
206
+ `trytilde-crewai`). The inventory goes to stderr; `tilde deploy --dry-run` prints the
197
207
  `DeploymentDeclarations` JSON; otherwise binary or large skill files are uploaded, the
198
208
  deployment is registered (`$TILDE_AGENT_ID`, `$TILDE_URL` = management API, and on Tilde Cloud
199
209
  `$TILDE_API_KEY`; open-source Tilde needs no key) and stdout is the deployment token (`--json`: `{"deploymentId", "token", "created"}`).
@@ -163,19 +163,28 @@ the next invocation without a redeploy. Frameworks without native skills convert
163
163
  their instructions. Framework adapters stamp dynamic prompts with
164
164
  `ctx.activate_prompt(name, hash)`.
165
165
 
166
- Prompts and skills are registered with a deployment:
166
+ Prompts and skills are registered with a deployment by the [Tilde CLI](https://trytilde.ai/docs/cli),
167
+ which this package asks for at its own version, so `uv run tilde` is the matching build:
167
168
 
168
169
  ```sh
169
- python -m tilde deploy [ENTRY] [--agent-id ID] [--url URL] [--api-key KEY] \
170
+ uv run tilde dev # register, run and chat with the agent locally
171
+ uv run tilde deploy [ENTRY] [--agent-id ID] [--url URL] [--api-key KEY] \
170
172
  [--target gateway|sidecar|lambda] [--function-arn ARN] [--external-id ID] [--label L] \
171
173
  [--dry-run] [--json]
172
174
  ```
173
175
 
176
+ The CLI reads what the code declares through this package's own entrypoint, which prints the
177
+ `DeploymentDeclarations` JSON and contacts nothing:
178
+
179
+ ```sh
180
+ tilde-declarations [ENTRY] [--allow-empty] # or: python -m tilde declarations [ENTRY]
181
+ ```
182
+
174
183
  `ENTRY` is a file or dotted module (default `main.py`), imported with `TILDE_DISCOVERY=1`
175
184
  (`connect_agent`/`run_connected_agent` then do nothing) and not as `__main__`. The globals of
176
185
  the entry and of every module loaded from the working directory are scanned for `define_*`
177
186
  objects and offered to framework discoverers (entry point group `tilde.discover`, for example
178
- `trytilde-crewai`). The inventory goes to stderr; `--dry-run` prints the
187
+ `trytilde-crewai`). The inventory goes to stderr; `tilde deploy --dry-run` prints the
179
188
  `DeploymentDeclarations` JSON; otherwise binary or large skill files are uploaded, the
180
189
  deployment is registered (`$TILDE_AGENT_ID`, `$TILDE_URL` = management API, and on Tilde Cloud
181
190
  `$TILDE_API_KEY`; open-source Tilde needs no key) and stdout is the deployment token (`--json`: `{"deploymentId", "token", "created"}`).
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "trytilde"
3
- version = "3.1.0"
3
+ version = "3.1.1"
4
4
  description = "Tilde agent SDK for Python: dial-in agent hosts, invocation context, channel tools, FastAPI integration and the chat proxy"
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -15,8 +15,14 @@ dependencies = [
15
15
  "opentelemetry-api>=1.30",
16
16
  "opentelemetry-sdk>=1.30",
17
17
  "opentelemetry-exporter-otlp-proto-common>=1.30",
18
+ # Installing the SDK brings the matching CLI, so `tilde` works in any agent project.
19
+ "trytilde-cli==3.1.1",
18
20
  ]
19
21
 
22
+ [project.scripts]
23
+ # The `tilde` CLI runs this to read what the agent's code declares.
24
+ tilde-declarations = "tilde.declarations:main"
25
+
20
26
  [project.optional-dependencies]
21
27
  fastapi = ["fastapi>=0.115"]
22
28
 
@@ -0,0 +1,12 @@
1
+ """``python -m tilde declarations [ENTRY]``; see ``tilde.declarations``."""
2
+
3
+ import sys
4
+
5
+ from tilde.declarations import main
6
+
7
+ if len(sys.argv) < 2 or sys.argv[1] != "declarations":
8
+ sys.exit(
9
+ "usage: python -m tilde declarations [ENTRY]\n"
10
+ "Run `tilde deploy` to register a deployment (see https://trytilde.ai/docs/cli)."
11
+ )
12
+ sys.exit(main(sys.argv[2:]))
@@ -1,24 +1,24 @@
1
- """``python -m tilde deploy``: discover an agent's prompts, skills and bundled tools and register a
2
- deployment.
1
+ """``tilde-declarations [ENTRY]``: print the prompts, skills and bundled tools an agent's code
2
+ declares, as protobuf JSON on stdout.
3
3
 
4
4
  The entry module is imported with ``TILDE_DISCOVERY=1`` (hosts do not dial) under a name
5
5
  other than ``__main__``. Its globals, and the globals of every module loaded from under the
6
6
  project directory (cwd), are offered to Tilde's own ``define_*`` recognition and to every
7
7
  framework discoverer registered in the ``tilde.discover`` entry point group (which also declare
8
- ``define_tools`` values). Flags match the
9
- TypeScript ``tilde deploy``.
8
+ ``define_tools`` values).
9
+
10
+ Only this interpreter can read declarations out of an agent's own modules, so this is the half
11
+ of ``tilde deploy`` that has to live in the SDK. The ``tilde`` CLI runs it and owns everything
12
+ after: uploading skill files and registering the deployment, once, for every language.
10
13
  """
11
14
 
12
15
  from __future__ import annotations
13
16
 
14
17
  import argparse
15
- import asyncio
16
18
  import contextlib
17
- import hashlib
18
19
  import importlib
19
20
  import importlib.metadata
20
21
  import importlib.util
21
- import json
22
22
  import os
23
23
  import sys
24
24
  import traceback
@@ -27,7 +27,6 @@ from pathlib import Path
27
27
  from types import ModuleType
28
28
  from typing import Any
29
29
 
30
- from connectrpc.errors import ConnectError
31
30
  from google.protobuf.json_format import MessageToJson
32
31
 
33
32
  from tilde._tools import BundledTools
@@ -40,15 +39,9 @@ from tilde.discovery import (
40
39
  from tilde.management.v1 import deployments_pb2
41
40
  from tilde.prompts import PromptDefinition
42
41
  from tilde.skills import ENTRYPOINT, SkillDefinition, SkillsDefinition
43
- from tilde.types.v1 import deployment_pb2
44
42
 
45
43
  MAX_INLINE_BYTES = 256 * 1024
46
44
  Discoverer = Callable[[Any, DiscoveryContext], Discovered | None]
47
- TARGETS = {
48
- "gateway": deployment_pb2.DEPLOYMENT_TARGET_GATEWAY,
49
- "sidecar": deployment_pb2.DEPLOYMENT_TARGET_SIDECAR,
50
- "lambda": deployment_pb2.DEPLOYMENT_TARGET_LAMBDA,
51
- }
52
45
  FORMATS = {1: "plain", 2: "mustache", 3: "braces", 4: "dynamic"}
53
46
 
54
47
 
@@ -278,102 +271,27 @@ def inventory(declarations: deployments_pb2.DeploymentDeclarations, warnings: li
278
271
 
279
272
  def parse_args(argv: list[str]) -> argparse.Namespace:
280
273
  parser = argparse.ArgumentParser(
281
- prog="tilde deploy",
282
- description="Register a deployment with the prompts, skills and tools the agent declares.",
274
+ prog="tilde-declarations",
275
+ description=(
276
+ "Print the prompts, skills and tools an agent declares, as protobuf JSON. "
277
+ "Run `tilde deploy` to register a deployment carrying them."
278
+ ),
283
279
  )
284
280
  parser.add_argument("entry", nargs="?", default="main.py", help="file path or dotted module")
285
- parser.add_argument("--agent-id", default=os.environ.get("TILDE_AGENT_ID"))
286
- parser.add_argument("--url", default=os.environ.get("TILDE_URL"))
287
- # Optional: open-source Tilde needs no management credential; Tilde Cloud requires one.
288
- parser.add_argument("--api-key", default=os.environ.get("TILDE_API_KEY"))
289
- parser.add_argument("--target", choices=sorted(TARGETS), default="gateway")
290
- parser.add_argument("--function-arn")
291
- parser.add_argument("--external-id")
292
- parser.add_argument("--label")
293
- parser.add_argument("--dry-run", action="store_true")
294
- parser.add_argument("--json", action="store_true")
295
- return parser.parse_args(argv)
296
-
297
-
298
- def _registration(
299
- args: argparse.Namespace, declarations: deployments_pb2.DeploymentDeclarations
300
- ) -> deployments_pb2.RegisterDeploymentRequest:
301
- env = os.environ
302
- ci = bool(env.get("CI") or env.get("GITHUB_ACTIONS"))
303
- source = deployment_pb2.DEPLOYMENT_SOURCE_CI if ci else deployment_pb2.DEPLOYMENT_SOURCE_MANUAL
304
- request = deployments_pb2.RegisterDeploymentRequest(
305
- agent_id=args.agent_id,
306
- source=source,
307
- target=TARGETS[args.target],
308
- declarations=declarations,
281
+ parser.add_argument(
282
+ "--allow-empty",
283
+ action="store_true",
284
+ help="print empty declarations instead of failing, for an agent that declares nothing",
309
285
  )
310
- external_id = args.external_id
311
- if external_id is None and env.get("GITHUB_REPOSITORY") and env.get("GITHUB_RUN_ID"):
312
- external_id = f"{env['GITHUB_REPOSITORY']}:{env['GITHUB_RUN_ID']}"
313
- optional = {
314
- "target_reference": args.function_arn,
315
- "external_id": external_id,
316
- "label": args.label,
317
- "repository": env.get("GITHUB_REPOSITORY"),
318
- "commit_sha": env.get("GITHUB_SHA"),
319
- "branch": env.get("GITHUB_REF_NAME"),
320
- }
321
- for field, value in optional.items():
322
- if value:
323
- setattr(request, field, value)
324
- return request
325
-
326
-
327
- async def register(
328
- args: argparse.Namespace, declarations: deployments_pb2.DeploymentDeclarations
329
- ) -> deployments_pb2.RegisterDeploymentResponse:
330
- from tilde.clients import create_management_client
331
-
332
- client = create_management_client(args.url, args.api_key).deployments
333
- # Files that cannot travel as text go by digest; upload only those Tilde lacks.
334
- pending: dict[str, bytes] = {}
335
- for skill in declarations.skills:
336
- for file in skill.files:
337
- if file.WhichOneof("body") == "data":
338
- digest = hashlib.sha256(file.data).hexdigest()
339
- pending[digest] = file.data
340
- file.sha256 = digest
341
- if pending:
342
- missing = await client.missing_deployment_files(
343
- deployments_pb2.MissingDeploymentFilesRequest(
344
- agent_id=args.agent_id, sha256=sorted(pending)
345
- )
346
- )
347
- for digest in missing.sha256:
348
- uploaded = await client.upload_deployment_file(
349
- deployments_pb2.UploadDeploymentFileRequest(
350
- agent_id=args.agent_id, data=pending[digest]
351
- )
352
- )
353
- if uploaded.sha256 != digest:
354
- raise DeployError("Tilde stored a skill file under a different digest")
355
- return await client.register_deployment(_registration(args, declarations))
286
+ return parser.parse_args(argv)
356
287
 
357
288
 
358
289
  def run(argv: list[str]) -> int:
359
290
  args = parse_args(argv)
360
- if not args.dry_run:
361
- missing = [
362
- flag
363
- for flag, value in (
364
- ("--agent-id / TILDE_AGENT_ID", args.agent_id),
365
- ("--url / TILDE_URL", args.url),
366
- )
367
- if not value
368
- ]
369
- if missing:
370
- raise DeployError(f"Missing {', '.join(missing)} (or pass --dry-run)")
371
- if (args.target == "lambda") != bool(args.function_arn):
372
- raise DeployError("--function-arn is required for lambda and only for lambda")
373
291
  os.environ["TILDE_DISCOVERY"] = "1"
374
292
  root = Path.cwd().resolve()
375
293
  warnings: list[str] = []
376
- # Stdout carries only the result (`TOKEN=$(tilde deploy)`); agent imports may print.
294
+ # Stdout carries only the JSON the `tilde` CLI reads; agent imports may print.
377
295
  with contextlib.redirect_stdout(sys.stderr):
378
296
  # The entry first: an adapter importing its framework must not shadow a project module
379
297
  # of the same name (a project `agents.py` beside the OpenAI Agents SDK's `agents`).
@@ -388,24 +306,14 @@ def run(argv: list[str]) -> int:
388
306
  modules = project_modules(entry, root)
389
307
  declarations = discover(modules, root, discoverers, warnings, imported_packages(modules))
390
308
  print(inventory(declarations, warnings), file=sys.stderr)
391
- if not declarations.prompts and not declarations.skills and not declarations.tools:
309
+ if (
310
+ not args.allow_empty
311
+ and not declarations.prompts
312
+ and not declarations.skills
313
+ and not declarations.tools
314
+ ):
392
315
  raise DeployError(f"Nothing to deploy: {args.entry} declares no prompts, skills or tools")
393
- if args.dry_run:
394
- print(MessageToJson(declarations))
395
- return 0
396
- response = asyncio.run(register(args, declarations))
397
- if args.json:
398
- print(
399
- json.dumps(
400
- {
401
- "deploymentId": response.deployment.id,
402
- "token": response.token or None,
403
- "created": response.created,
404
- }
405
- )
406
- )
407
- else:
408
- print(response.token)
316
+ print(MessageToJson(declarations))
409
317
  return 0
410
318
 
411
319
 
@@ -413,8 +321,5 @@ def main(argv: list[str] | None = None) -> int:
413
321
  try:
414
322
  return run(sys.argv[1:] if argv is None else argv)
415
323
  except DeployError as error:
416
- print(f"tilde deploy: {error}", file=sys.stderr)
417
- return 1
418
- except ConnectError as error:
419
- print(f"tilde deploy: {error.code.name.lower()}: {error.message}", file=sys.stderr)
324
+ print(f"tilde-declarations: {error}", file=sys.stderr)
420
325
  return 1
@@ -1,9 +0,0 @@
1
- """``python -m tilde deploy [ENTRY] ...``; see ``tilde.deploy``."""
2
-
3
- import sys
4
-
5
- from tilde.deploy import main
6
-
7
- if len(sys.argv) < 2 or sys.argv[1] != "deploy":
8
- sys.exit("usage: python -m tilde deploy [ENTRY] [options] (see python -m tilde deploy --help)")
9
- sys.exit(main(sys.argv[2:]))
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes