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.1.tar.gz
(6.6 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.1.tar.gz.
File metadata
- Download URL: welt_io-0.1.1.tar.gz
- Upload date:
- Size: 6.6 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 |
b2ee7bdfc7c5917596c866554cc4a0838744b637b13be6709fb70119eb4791c2
|
|
| MD5 |
9ff4fe395bb978d5831d3092799169f1
|
|
| BLAKE2b-256 |
cf61e78bc66fb88242b1db0b2e889f1651ee6e9993720c699ac495742e020ecc
|
File details
Details for the file welt_io-0.1.1-py3-none-any.whl.
File metadata
- Download URL: welt_io-0.1.1-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 |
91bc58364400065fc21d1f987d22fc87c337faf2769e838fbb39f77689e4aa25
|
|
| MD5 |
9f7de54d847167dd882c9414a7b8d44b
|
|
| BLAKE2b-256 |
9b1317b66afe2343cd37b04be88b084231e7283309d5c8c75c08651346d63cbd
|