trytilde 3.0.1__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.
- {trytilde-3.0.1 → trytilde-3.1.1}/.gitignore +2 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/PKG-INFO +14 -4
- {trytilde-3.0.1 → trytilde-3.1.1}/README.md +12 -3
- {trytilde-3.0.1 → trytilde-3.1.1}/pyproject.toml +7 -1
- trytilde-3.1.1/src/tilde/__main__.py +12 -0
- trytilde-3.0.1/src/tilde/deploy.py → trytilde-3.1.1/src/tilde/declarations.py +26 -121
- trytilde-3.0.1/src/tilde/__main__.py +0 -9
- {trytilde-3.0.1 → trytilde-3.1.1}/hatch_build.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/__init__.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/_cancel.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/_inference.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/_invocation.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/_otlp.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/_tools.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/_transport.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/agent_event_ingress/__init__.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/agent_event_ingress/v1/__init__.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/agent_event_ingress/v1/sidecars_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/agent_event_ingress/v1/sidecars_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/agent_event_ingress/v1/sidecars_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/agent_host/__init__.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/agent_host/v1/__init__.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/agent_host/v1/agent_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/agent_host/v1/agent_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/channels.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/chat_proxy.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/clients.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/context.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/discovery.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/fastapi.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/host.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/logging.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/__init__.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/__init__.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/access_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/access_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/access_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/agents_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/agents_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/agents_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/connections_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/connections_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/connections_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/deployments_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/deployments_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/deployments_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/identities_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/identities_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/identities_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/inference_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/inference_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/inference_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/logs_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/logs_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/logs_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/prompts_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/prompts_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/prompts_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/skills_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/skills_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/skills_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/tilde_chat_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/tilde_chat_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/tilde_chat_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/tools_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/tools_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/tools_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/tracing_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/tracing_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/management/v1/tracing_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/messages.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/prompts.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/provider/__init__.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/provider/tilde/__init__.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/provider/tilde/v1/__init__.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/provider/tilde/v1/chat_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/provider/tilde/v1/chat_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/provider/tilde/v1/chat_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/provider/v1/__init__.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/provider/v1/connections_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/provider/v1/connections_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/provider/v1/connections_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/run/__init__.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/run/v1/__init__.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/run/v1/run_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/run/v1/run_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/run/v1/run_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/runtime/__init__.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/runtime/v1/__init__.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/runtime/v1/agents_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/runtime/v1/agents_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/runtime/v1/agents_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/runtime/v1/cache_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/runtime/v1/cache_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/runtime/v1/chat_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/runtime/v1/chat_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/runtime/v1/chat_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/runtime/v1/controls_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/runtime/v1/controls_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/runtime/v1/controls_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/runtime/v1/prompts_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/runtime/v1/prompts_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/runtime/v1/prompts_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/runtime/v1/skills_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/runtime/v1/skills_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/runtime/v1/skills_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/setup/__init__.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/setup/v1/__init__.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/setup/v1/connections_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/setup/v1/connections_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/setup/v1/connections_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/setup/v1/identity_verification_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/setup/v1/identity_verification_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/setup/v1/identity_verification_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/skills.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/tool_host/v1/tool_host_connect.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/tool_host/v1/tool_host_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/tool_host/v1/tool_host_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/tool_hosts.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/tracing.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/types/__init__.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/types/v1/__init__.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/types/v1/access_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/types/v1/access_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/types/v1/agent_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/types/v1/agent_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/types/v1/chat_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/types/v1/chat_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/types/v1/connections_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/types/v1/connections_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/types/v1/deployment_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/types/v1/deployment_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/types/v1/prompt_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/types/v1/prompt_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/types/v1/runtime_event_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/types/v1/runtime_event_pb2.pyi +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/types/v1/skill_pb2.py +0 -0
- {trytilde-3.0.1 → trytilde-3.1.1}/src/tilde/types/v1/skill_pb2.pyi +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: trytilde
|
|
3
|
-
Version: 3.
|
|
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
|
-
|
|
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;
|
|
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
|
-
|
|
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;
|
|
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.
|
|
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
|
-
"""``
|
|
2
|
-
|
|
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).
|
|
9
|
-
|
|
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
|
|
282
|
-
description=
|
|
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(
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|