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

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.0.tar.gz (7.9 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.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: welt_io-0.2.0.tar.gz
  • Upload date:
  • Size: 7.9 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.0.tar.gz
Algorithm Hash digest
SHA256 a561990062bd61f38db972ed48626b824a158581911ec1a5f94876d9556a4032
MD5 4483856c3eb496debfb8eb7e8ad5eb21
BLAKE2b-256 bb03c5f4ce59ea903b099efdc40f8a9ac79c45eeeb69828a04f36e82889cc186

See more details on using hashes here.

File details

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

File metadata

  • Download URL: welt_io-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8cb5c78eedc862a35c8f376786348b06fa30a54c83a68f5d69cc33d710e3a6f8
MD5 8f6c5ba3cf5f8a93acbcb9e505eadabd
BLAKE2b-256 ad5bccf77502c584129557c6f60ea78777118723fdb87296de50a96a83b6c973

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