trytilde 3.1.0__tar.gz → 3.1.2__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.1.0 → trytilde-3.1.2}/.gitignore +3 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/PKG-INFO +14 -4
- {trytilde-3.1.0 → trytilde-3.1.2}/README.md +12 -3
- {trytilde-3.1.0 → trytilde-3.1.2}/pyproject.toml +7 -1
- trytilde-3.1.2/src/tilde/__main__.py +12 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/agent_event_ingress/v1/sidecars_connect.py +37 -9
- trytilde-3.1.0/src/tilde/deploy.py → trytilde-3.1.2/src/tilde/declarations.py +26 -121
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/access_connect.py +25 -6
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/agents_connect.py +37 -9
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/connections_connect.py +45 -11
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/deployments_connect.py +49 -12
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/identities_connect.py +37 -9
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/inference_connect.py +21 -5
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/logs_connect.py +13 -3
- trytilde-3.1.2/src/tilde/management/v1/memory_connect.py +2380 -0
- trytilde-3.1.2/src/tilde/management/v1/memory_pb2.py +217 -0
- trytilde-3.1.2/src/tilde/management/v1/memory_pb2.pyi +753 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/prompts_connect.py +13 -3
- trytilde-3.1.2/src/tilde/management/v1/routines_connect.py +528 -0
- trytilde-3.1.2/src/tilde/management/v1/routines_pb2.py +73 -0
- trytilde-3.1.2/src/tilde/management/v1/routines_pb2.pyi +162 -0
- trytilde-3.1.2/src/tilde/management/v1/sandboxes_connect.py +1084 -0
- trytilde-3.1.2/src/tilde/management/v1/sandboxes_pb2.py +107 -0
- trytilde-3.1.2/src/tilde/management/v1/sandboxes_pb2.pyi +273 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/skills_connect.py +97 -24
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/tilde_chat_connect.py +13 -3
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/tools_connect.py +81 -16
- trytilde-3.1.2/src/tilde/management/v1/tools_pb2.py +135 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/tools_pb2.pyi +18 -8
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/tracing_connect.py +25 -6
- trytilde-3.1.2/src/tilde/management/v1/wikis_connect.py +1520 -0
- trytilde-3.1.2/src/tilde/management/v1/wikis_pb2.py +141 -0
- trytilde-3.1.2/src/tilde/management/v1/wikis_pb2.pyi +393 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/provider/tilde/v1/chat_connect.py +125 -31
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/provider/v1/connections_connect.py +9 -2
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/run/v1/run_connect.py +17 -4
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/runtime/v1/agents_connect.py +25 -6
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/runtime/v1/chat_connect.py +85 -21
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/runtime/v1/controls_connect.py +13 -3
- trytilde-3.1.2/src/tilde/runtime/v1/knowledge_connect.py +308 -0
- trytilde-3.1.2/src/tilde/runtime/v1/knowledge_pb2.py +47 -0
- trytilde-3.1.2/src/tilde/runtime/v1/knowledge_pb2.pyi +34 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/runtime/v1/prompts_connect.py +9 -2
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/runtime/v1/skills_connect.py +33 -8
- trytilde-3.1.2/src/tilde/sandbox/v1/sandbox_connect.py +448 -0
- trytilde-3.1.2/src/tilde/sandbox/v1/sandbox_pb2.py +73 -0
- trytilde-3.1.2/src/tilde/sandbox/v1/sandbox_pb2.pyi +94 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/setup/v1/connections_connect.py +33 -8
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/setup/v1/identity_verification_connect.py +13 -3
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/tool_host/v1/tool_host_connect.py +13 -3
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/tool_host/v1/tool_host_pb2.py +16 -16
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/tool_host/v1/tool_host_pb2.pyi +4 -2
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/tool_hosts.py +5 -1
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/types/v1/connections_pb2.py +10 -10
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/types/v1/connections_pb2.pyi +2 -0
- trytilde-3.1.0/src/tilde/__main__.py +0 -9
- trytilde-3.1.0/src/tilde/management/v1/tools_pb2.py +0 -135
- {trytilde-3.1.0 → trytilde-3.1.2}/hatch_build.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/__init__.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/_cancel.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/_inference.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/_invocation.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/_otlp.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/_tools.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/_transport.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/agent_event_ingress/__init__.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/agent_event_ingress/v1/__init__.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/agent_event_ingress/v1/sidecars_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/agent_event_ingress/v1/sidecars_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/agent_host/__init__.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/agent_host/v1/__init__.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/agent_host/v1/agent_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/agent_host/v1/agent_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/channels.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/chat_proxy.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/clients.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/context.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/discovery.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/fastapi.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/host.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/logging.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/__init__.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/__init__.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/access_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/access_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/agents_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/agents_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/connections_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/connections_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/deployments_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/deployments_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/identities_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/identities_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/inference_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/inference_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/logs_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/logs_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/prompts_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/prompts_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/skills_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/skills_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/tilde_chat_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/tilde_chat_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/tracing_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/management/v1/tracing_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/messages.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/prompts.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/provider/__init__.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/provider/tilde/__init__.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/provider/tilde/v1/__init__.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/provider/tilde/v1/chat_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/provider/tilde/v1/chat_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/provider/v1/__init__.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/provider/v1/connections_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/provider/v1/connections_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/run/__init__.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/run/v1/__init__.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/run/v1/run_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/run/v1/run_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/runtime/__init__.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/runtime/v1/__init__.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/runtime/v1/agents_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/runtime/v1/agents_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/runtime/v1/cache_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/runtime/v1/cache_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/runtime/v1/chat_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/runtime/v1/chat_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/runtime/v1/controls_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/runtime/v1/controls_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/runtime/v1/prompts_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/runtime/v1/prompts_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/runtime/v1/skills_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/runtime/v1/skills_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/setup/__init__.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/setup/v1/__init__.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/setup/v1/connections_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/setup/v1/connections_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/setup/v1/identity_verification_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/setup/v1/identity_verification_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/skills.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/tracing.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/types/__init__.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/types/v1/__init__.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/types/v1/access_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/types/v1/access_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/types/v1/agent_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/types/v1/agent_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/types/v1/chat_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/types/v1/chat_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/types/v1/deployment_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/types/v1/deployment_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/types/v1/prompt_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/types/v1/prompt_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/types/v1/runtime_event_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/types/v1/runtime_event_pb2.pyi +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/src/tilde/types/v1/skill_pb2.py +0 -0
- {trytilde-3.1.0 → trytilde-3.1.2}/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/
|
|
@@ -43,6 +45,7 @@ log
|
|
|
43
45
|
/sdk/py/packages/tilde/src/tilde/provider/
|
|
44
46
|
/sdk/py/packages/tilde/src/tilde/run/
|
|
45
47
|
/sdk/py/packages/tilde/src/tilde/runtime/
|
|
48
|
+
/sdk/py/packages/tilde/src/tilde/sandbox/
|
|
46
49
|
/sdk/py/packages/tilde/src/tilde/setup/
|
|
47
50
|
/sdk/py/packages/tilde/src/tilde/tool_host/
|
|
48
51
|
/sdk/py/packages/tilde/src/tilde/types/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: trytilde
|
|
3
|
-
Version: 3.1.
|
|
3
|
+
Version: 3.1.2
|
|
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.2
|
|
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.1.
|
|
3
|
+
version = "3.1.2"
|
|
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.2",
|
|
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,7 +1,10 @@
|
|
|
1
1
|
# Generated from tilde/agent_event_ingress/v1/sidecars.proto. DO NOT EDIT.
|
|
2
|
-
# Generated by protoc-gen-connectrpc-py v0.
|
|
2
|
+
# Generated by protoc-gen-connectrpc-py v0.13.0 with parameter "protobuf=google".
|
|
3
3
|
# ruff: noqa: PGH004
|
|
4
4
|
# ruff: noqa
|
|
5
|
+
# pyright: reportDeprecated=false
|
|
6
|
+
# ty: ignore[unused-ignore-comment]
|
|
7
|
+
# ty: ignore[deprecated, unused-ignore-comment]
|
|
5
8
|
# fmt: off
|
|
6
9
|
|
|
7
10
|
from __future__ import annotations
|
|
@@ -13,7 +16,7 @@ from connectrpc.code import Code
|
|
|
13
16
|
from connectrpc.compat import google_protobuf_binary_codec, google_protobuf_codecs
|
|
14
17
|
from connectrpc.compression.gzip import GzipCompression
|
|
15
18
|
from connectrpc.errors import ConnectError
|
|
16
|
-
from connectrpc.method import IdempotencyLevel, MethodInfo
|
|
19
|
+
from connectrpc.method import IdempotencyLevel, MethodInfo, StreamType
|
|
17
20
|
from connectrpc.protocol import ProtocolType
|
|
18
21
|
from connectrpc.server import ConnectASGIApplication, ConnectWSGIApplication, DEFAULT_READ_MAX_BYTES, Endpoint, EndpointSync
|
|
19
22
|
from pyqwest import Client, SyncClient
|
|
@@ -102,6 +105,7 @@ class SidecarServiceASGIApplication(ConnectASGIApplication[SidecarService]):
|
|
|
102
105
|
input=WatchRequest,
|
|
103
106
|
output=WatchResponse,
|
|
104
107
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
108
|
+
stream_type=StreamType.SERVER_STREAM,
|
|
105
109
|
),
|
|
106
110
|
function=svc.watch,
|
|
107
111
|
),
|
|
@@ -112,6 +116,7 @@ class SidecarServiceASGIApplication(ConnectASGIApplication[SidecarService]):
|
|
|
112
116
|
input=PublishRequest,
|
|
113
117
|
output=PublishResponse,
|
|
114
118
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
119
|
+
stream_type=StreamType.UNARY,
|
|
115
120
|
),
|
|
116
121
|
function=svc.publish,
|
|
117
122
|
),
|
|
@@ -122,6 +127,7 @@ class SidecarServiceASGIApplication(ConnectASGIApplication[SidecarService]):
|
|
|
122
127
|
input=HydrateRequest,
|
|
123
128
|
output=HydrateResponse,
|
|
124
129
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
130
|
+
stream_type=StreamType.UNARY,
|
|
125
131
|
),
|
|
126
132
|
function=svc.hydrate,
|
|
127
133
|
),
|
|
@@ -132,6 +138,7 @@ class SidecarServiceASGIApplication(ConnectASGIApplication[SidecarService]):
|
|
|
132
138
|
input=ForwardRequest,
|
|
133
139
|
output=ForwardResponse,
|
|
134
140
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
141
|
+
stream_type=StreamType.UNARY,
|
|
135
142
|
),
|
|
136
143
|
function=svc.forward,
|
|
137
144
|
),
|
|
@@ -142,6 +149,7 @@ class SidecarServiceASGIApplication(ConnectASGIApplication[SidecarService]):
|
|
|
142
149
|
input=UploadAttachmentRequest,
|
|
143
150
|
output=UploadAttachmentResponse,
|
|
144
151
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
152
|
+
stream_type=StreamType.UNARY,
|
|
145
153
|
),
|
|
146
154
|
function=svc.upload_attachment,
|
|
147
155
|
),
|
|
@@ -152,6 +160,7 @@ class SidecarServiceASGIApplication(ConnectASGIApplication[SidecarService]):
|
|
|
152
160
|
input=DownloadAttachmentRequest,
|
|
153
161
|
output=DownloadAttachmentResponse,
|
|
154
162
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
163
|
+
stream_type=StreamType.UNARY,
|
|
155
164
|
),
|
|
156
165
|
function=svc.download_attachment,
|
|
157
166
|
),
|
|
@@ -162,6 +171,7 @@ class SidecarServiceASGIApplication(ConnectASGIApplication[SidecarService]):
|
|
|
162
171
|
input=ResolveParticipantRequest,
|
|
163
172
|
output=ResolveParticipantResponse,
|
|
164
173
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
174
|
+
stream_type=StreamType.UNARY,
|
|
165
175
|
),
|
|
166
176
|
function=svc.resolve_participant,
|
|
167
177
|
),
|
|
@@ -172,6 +182,7 @@ class SidecarServiceASGIApplication(ConnectASGIApplication[SidecarService]):
|
|
|
172
182
|
input=RelayRequest,
|
|
173
183
|
output=RelayResponse,
|
|
174
184
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
185
|
+
stream_type=StreamType.UNARY,
|
|
175
186
|
),
|
|
176
187
|
function=svc.relay,
|
|
177
188
|
),
|
|
@@ -238,11 +249,11 @@ class SidecarServiceClient(ConnectClient):
|
|
|
238
249
|
input=WatchRequest,
|
|
239
250
|
output=WatchResponse,
|
|
240
251
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
252
|
+
stream_type=StreamType.SERVER_STREAM,
|
|
241
253
|
),
|
|
242
254
|
headers=headers,
|
|
243
255
|
timeout_ms=timeout_ms,
|
|
244
256
|
)
|
|
245
|
-
|
|
246
257
|
async def publish(
|
|
247
258
|
self,
|
|
248
259
|
request: PublishRequest,
|
|
@@ -261,11 +272,11 @@ class SidecarServiceClient(ConnectClient):
|
|
|
261
272
|
input=PublishRequest,
|
|
262
273
|
output=PublishResponse,
|
|
263
274
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
275
|
+
stream_type=StreamType.UNARY,
|
|
264
276
|
),
|
|
265
277
|
headers=headers,
|
|
266
278
|
timeout_ms=timeout_ms,
|
|
267
279
|
)
|
|
268
|
-
|
|
269
280
|
async def hydrate(
|
|
270
281
|
self,
|
|
271
282
|
request: HydrateRequest,
|
|
@@ -284,11 +295,11 @@ class SidecarServiceClient(ConnectClient):
|
|
|
284
295
|
input=HydrateRequest,
|
|
285
296
|
output=HydrateResponse,
|
|
286
297
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
298
|
+
stream_type=StreamType.UNARY,
|
|
287
299
|
),
|
|
288
300
|
headers=headers,
|
|
289
301
|
timeout_ms=timeout_ms,
|
|
290
302
|
)
|
|
291
|
-
|
|
292
303
|
async def forward(
|
|
293
304
|
self,
|
|
294
305
|
request: ForwardRequest,
|
|
@@ -307,11 +318,11 @@ class SidecarServiceClient(ConnectClient):
|
|
|
307
318
|
input=ForwardRequest,
|
|
308
319
|
output=ForwardResponse,
|
|
309
320
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
321
|
+
stream_type=StreamType.UNARY,
|
|
310
322
|
),
|
|
311
323
|
headers=headers,
|
|
312
324
|
timeout_ms=timeout_ms,
|
|
313
325
|
)
|
|
314
|
-
|
|
315
326
|
async def upload_attachment(
|
|
316
327
|
self,
|
|
317
328
|
request: UploadAttachmentRequest,
|
|
@@ -327,11 +338,11 @@ class SidecarServiceClient(ConnectClient):
|
|
|
327
338
|
input=UploadAttachmentRequest,
|
|
328
339
|
output=UploadAttachmentResponse,
|
|
329
340
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
341
|
+
stream_type=StreamType.UNARY,
|
|
330
342
|
),
|
|
331
343
|
headers=headers,
|
|
332
344
|
timeout_ms=timeout_ms,
|
|
333
345
|
)
|
|
334
|
-
|
|
335
346
|
async def download_attachment(
|
|
336
347
|
self,
|
|
337
348
|
request: DownloadAttachmentRequest,
|
|
@@ -347,11 +358,11 @@ class SidecarServiceClient(ConnectClient):
|
|
|
347
358
|
input=DownloadAttachmentRequest,
|
|
348
359
|
output=DownloadAttachmentResponse,
|
|
349
360
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
361
|
+
stream_type=StreamType.UNARY,
|
|
350
362
|
),
|
|
351
363
|
headers=headers,
|
|
352
364
|
timeout_ms=timeout_ms,
|
|
353
365
|
)
|
|
354
|
-
|
|
355
366
|
async def resolve_participant(
|
|
356
367
|
self,
|
|
357
368
|
request: ResolveParticipantRequest,
|
|
@@ -367,11 +378,11 @@ class SidecarServiceClient(ConnectClient):
|
|
|
367
378
|
input=ResolveParticipantRequest,
|
|
368
379
|
output=ResolveParticipantResponse,
|
|
369
380
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
381
|
+
stream_type=StreamType.UNARY,
|
|
370
382
|
),
|
|
371
383
|
headers=headers,
|
|
372
384
|
timeout_ms=timeout_ms,
|
|
373
385
|
)
|
|
374
|
-
|
|
375
386
|
async def relay(
|
|
376
387
|
self,
|
|
377
388
|
request: RelayRequest,
|
|
@@ -390,6 +401,7 @@ class SidecarServiceClient(ConnectClient):
|
|
|
390
401
|
input=RelayRequest,
|
|
391
402
|
output=RelayResponse,
|
|
392
403
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
404
|
+
stream_type=StreamType.UNARY,
|
|
393
405
|
),
|
|
394
406
|
headers=headers,
|
|
395
407
|
timeout_ms=timeout_ms,
|
|
@@ -461,6 +473,7 @@ class SidecarServiceWSGIApplication(ConnectWSGIApplication):
|
|
|
461
473
|
input=WatchRequest,
|
|
462
474
|
output=WatchResponse,
|
|
463
475
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
476
|
+
stream_type=StreamType.SERVER_STREAM,
|
|
464
477
|
),
|
|
465
478
|
function=service.watch,
|
|
466
479
|
),
|
|
@@ -471,6 +484,7 @@ class SidecarServiceWSGIApplication(ConnectWSGIApplication):
|
|
|
471
484
|
input=PublishRequest,
|
|
472
485
|
output=PublishResponse,
|
|
473
486
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
487
|
+
stream_type=StreamType.UNARY,
|
|
474
488
|
),
|
|
475
489
|
function=service.publish,
|
|
476
490
|
),
|
|
@@ -481,6 +495,7 @@ class SidecarServiceWSGIApplication(ConnectWSGIApplication):
|
|
|
481
495
|
input=HydrateRequest,
|
|
482
496
|
output=HydrateResponse,
|
|
483
497
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
498
|
+
stream_type=StreamType.UNARY,
|
|
484
499
|
),
|
|
485
500
|
function=service.hydrate,
|
|
486
501
|
),
|
|
@@ -491,6 +506,7 @@ class SidecarServiceWSGIApplication(ConnectWSGIApplication):
|
|
|
491
506
|
input=ForwardRequest,
|
|
492
507
|
output=ForwardResponse,
|
|
493
508
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
509
|
+
stream_type=StreamType.UNARY,
|
|
494
510
|
),
|
|
495
511
|
function=service.forward,
|
|
496
512
|
),
|
|
@@ -501,6 +517,7 @@ class SidecarServiceWSGIApplication(ConnectWSGIApplication):
|
|
|
501
517
|
input=UploadAttachmentRequest,
|
|
502
518
|
output=UploadAttachmentResponse,
|
|
503
519
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
520
|
+
stream_type=StreamType.UNARY,
|
|
504
521
|
),
|
|
505
522
|
function=service.upload_attachment,
|
|
506
523
|
),
|
|
@@ -511,6 +528,7 @@ class SidecarServiceWSGIApplication(ConnectWSGIApplication):
|
|
|
511
528
|
input=DownloadAttachmentRequest,
|
|
512
529
|
output=DownloadAttachmentResponse,
|
|
513
530
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
531
|
+
stream_type=StreamType.UNARY,
|
|
514
532
|
),
|
|
515
533
|
function=service.download_attachment,
|
|
516
534
|
),
|
|
@@ -521,6 +539,7 @@ class SidecarServiceWSGIApplication(ConnectWSGIApplication):
|
|
|
521
539
|
input=ResolveParticipantRequest,
|
|
522
540
|
output=ResolveParticipantResponse,
|
|
523
541
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
542
|
+
stream_type=StreamType.UNARY,
|
|
524
543
|
),
|
|
525
544
|
function=service.resolve_participant,
|
|
526
545
|
),
|
|
@@ -531,6 +550,7 @@ class SidecarServiceWSGIApplication(ConnectWSGIApplication):
|
|
|
531
550
|
input=RelayRequest,
|
|
532
551
|
output=RelayResponse,
|
|
533
552
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
553
|
+
stream_type=StreamType.UNARY,
|
|
534
554
|
),
|
|
535
555
|
function=service.relay,
|
|
536
556
|
),
|
|
@@ -597,6 +617,7 @@ class SidecarServiceClientSync(ConnectClientSync):
|
|
|
597
617
|
input=WatchRequest,
|
|
598
618
|
output=WatchResponse,
|
|
599
619
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
620
|
+
stream_type=StreamType.SERVER_STREAM,
|
|
600
621
|
),
|
|
601
622
|
headers=headers,
|
|
602
623
|
timeout_ms=timeout_ms,
|
|
@@ -619,6 +640,7 @@ class SidecarServiceClientSync(ConnectClientSync):
|
|
|
619
640
|
input=PublishRequest,
|
|
620
641
|
output=PublishResponse,
|
|
621
642
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
643
|
+
stream_type=StreamType.UNARY,
|
|
622
644
|
),
|
|
623
645
|
headers=headers,
|
|
624
646
|
timeout_ms=timeout_ms,
|
|
@@ -641,6 +663,7 @@ class SidecarServiceClientSync(ConnectClientSync):
|
|
|
641
663
|
input=HydrateRequest,
|
|
642
664
|
output=HydrateResponse,
|
|
643
665
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
666
|
+
stream_type=StreamType.UNARY,
|
|
644
667
|
),
|
|
645
668
|
headers=headers,
|
|
646
669
|
timeout_ms=timeout_ms,
|
|
@@ -663,6 +686,7 @@ class SidecarServiceClientSync(ConnectClientSync):
|
|
|
663
686
|
input=ForwardRequest,
|
|
664
687
|
output=ForwardResponse,
|
|
665
688
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
689
|
+
stream_type=StreamType.UNARY,
|
|
666
690
|
),
|
|
667
691
|
headers=headers,
|
|
668
692
|
timeout_ms=timeout_ms,
|
|
@@ -682,6 +706,7 @@ class SidecarServiceClientSync(ConnectClientSync):
|
|
|
682
706
|
input=UploadAttachmentRequest,
|
|
683
707
|
output=UploadAttachmentResponse,
|
|
684
708
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
709
|
+
stream_type=StreamType.UNARY,
|
|
685
710
|
),
|
|
686
711
|
headers=headers,
|
|
687
712
|
timeout_ms=timeout_ms,
|
|
@@ -701,6 +726,7 @@ class SidecarServiceClientSync(ConnectClientSync):
|
|
|
701
726
|
input=DownloadAttachmentRequest,
|
|
702
727
|
output=DownloadAttachmentResponse,
|
|
703
728
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
729
|
+
stream_type=StreamType.UNARY,
|
|
704
730
|
),
|
|
705
731
|
headers=headers,
|
|
706
732
|
timeout_ms=timeout_ms,
|
|
@@ -720,6 +746,7 @@ class SidecarServiceClientSync(ConnectClientSync):
|
|
|
720
746
|
input=ResolveParticipantRequest,
|
|
721
747
|
output=ResolveParticipantResponse,
|
|
722
748
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
749
|
+
stream_type=StreamType.UNARY,
|
|
723
750
|
),
|
|
724
751
|
headers=headers,
|
|
725
752
|
timeout_ms=timeout_ms,
|
|
@@ -742,6 +769,7 @@ class SidecarServiceClientSync(ConnectClientSync):
|
|
|
742
769
|
input=RelayRequest,
|
|
743
770
|
output=RelayResponse,
|
|
744
771
|
idempotency_level=IdempotencyLevel.UNKNOWN,
|
|
772
|
+
stream_type=StreamType.UNARY,
|
|
745
773
|
),
|
|
746
774
|
headers=headers,
|
|
747
775
|
timeout_ms=timeout_ms,
|
|
@@ -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
|