Agent-side adapters for Welt's wire contract
Project description
welt-io
Agent-side adapters for Welt's wire contract.
The wire between Welt and your agent is JSON, and plain Strands values do not fit it in either direction:
- Inbound, JSON cannot carry raw bytes, so Welt base64-encodes the
bytesslot of the Converse image/document/video blocks it builds from Slack uploads.decode_file_blocksrestores them before Strands (Bedrock Converse) sees the messages; without uploads it is a no-op. - Outbound, raw
stream_asyncevents carry values that are not JSON-serializable (the Agent itself, UUIDs, traces), which the AgentCore Runtime SDK would degrade to a plain string on the SSE wire.renderable_eventsreduces the stream to the events Welt renders: text chunks (data), tool-use starts (current_tool_use), and tool completions (tool_result, slimmed to the toolUseId and status so tool output stays off the wire).
Install
uv add welt-io
Usage
from collections.abc import AsyncIterator
from bedrock_agentcore.runtime import BedrockAgentCoreApp
from strands import Agent
from welt_io import decode_file_blocks, renderable_events
app = BedrockAgentCoreApp()
@app.entrypoint
async def invoke(payload: dict) -> AsyncIterator[dict]:
messages = payload["messages"]
decode_file_blocks(messages) # base64 file bytes -> raw bytes, in place
agent = Agent()
# Reduce the stream to the JSON-serializable events Welt renders
async for event in renderable_events(agent.stream_async(messages)):
yield event
if __name__ == "__main__":
app.run()
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
welt_io-0.1.0.tar.gz
(6.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file welt_io-0.1.0.tar.gz.
File metadata
- Download URL: welt_io-0.1.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d463e3ea3f2e267f0b62dbadbc68648c7f45cb75f59d2a45a8bad6722545dbab
|
|
| MD5 |
7d7715dfc22051d754c29532e2c5e7b6
|
|
| BLAKE2b-256 |
035ad82f49d504507f008449883cbae0dec5640135e8d2d1ff850629e1084c6f
|
File details
Details for the file welt_io-0.1.0-py3-none-any.whl.
File metadata
- Download URL: welt_io-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee417892642eb26f804394fced625049ddf37e361e6c860bab4901450d7332d8
|
|
| MD5 |
5b71ac8551a078af3acfc3ba59b69fd8
|
|
| BLAKE2b-256 |
9f91db7138ed74fe096bb7ef692c791018ed0e2609816d1f46fd84e85169f512
|