Skip to main content

Agent-side adapters for Welt's wire contract

Project description

welt-io

pypi python

Agent-side adapters for Welt's wire contract.

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()

Adapters

The wire between Welt and your agent is JSON, and plain Strands values do not fit it in either direction.

Inbound

decode_file_blocks(messages) restores the base64-encoded file bytes in Welt's Converse-shaped messages (built from Slack uploads) back to the raw bytes Strands expects, in place. Without uploads it is a no-op.

Outbound

renderable_events(events) reduces raw stream_async events — not JSON-serializable as-is — to the events Welt renders: text chunks (data), tool-use indicators (current_tool_use / tool_result, slimmed so text tool output stays off the wire), and generated files (file, a filename plus base64 bytes for each image/document/video block a tool or the model produces, which Welt uploads to the Slack thread).

file_event(name, data) builds the same file event from a filename and raw bytes, for attaching arbitrary files of your own:

yield file_event("report.csv", csv_bytes)

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.2.1.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

welt_io-0.2.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file welt_io-0.2.1.tar.gz.

File metadata

  • Download URL: welt_io-0.2.1.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","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

Hashes for welt_io-0.2.1.tar.gz
Algorithm Hash digest
SHA256 bc52d19db6547fc249f323be89b7d5797c513f29f12b77f4f50260cdeaed593f
MD5 75a6e0db6556241ce3c3db195534e78b
BLAKE2b-256 5abb03f061cfdc190419151b9a34f5f55be46517a753a6ca6da6ce3f7f01265c

See more details on using hashes here.

File details

Details for the file welt_io-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: welt_io-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","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

Hashes for welt_io-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 72887bf9fe7386f09c53defcc73643913f141efe3a38cd1b37f26b8ee5d2aac2
MD5 b639eaa164f7b065f6654aa53ea575fa
BLAKE2b-256 3e06d9e5d4a325ca0d2a69f8977dbcdb1ef72114a1832849593a60ae0b6c2aeb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page