Skip to main content

here-i-strand (HIS) agent module. Provides a custom Strands agent with DynamoDB status tracking, S3 session persistence and a concurrent tool executor with per-tool timeouts

Project description

Here I Strand

Library that provides a Strands agent for AWS Bedrock Agent Core with DynamoDB status tracking, S3 session persistence, and a concurrent tool executor with per-tool timeouts (HIS: here-i-strand).

Repository: github.com/tisaarus/here-i-strand

Installation

pip install here-i-strand
# or with uv
uv add here-i-strand

Quick start

You define how to load configuration (environment variables, your own settings module, etc.) and pass the values to HISAgent:

import os
from his import HISAgent

agent = HISAgent(
    bucket_name=os.environ["BUCKET_NAME"],
    status_dynamo_table_name=os.environ["STATUS_DYNAMO_TABLE_NAME"],
    session_id="my-session-id",
    name=os.environ.get("AGENT_NAME", "my-agent"),
    agent_id=os.environ.get("AGENT_ID"),  # Optional: unique identifier for the agent instance
    tools=[...],
)

Configuration

The library does not provide a settings layer. Pass bucket_name, status_dynamo_table_name, session_id, and optionally name, agent_id (and any other HISAgent arguments) from your own config:

  • Environment variables
  • A .env file loaded by your app (e.g. python-dotenv, pydantic-settings)
  • Any other configuration source you use

Project structure (development)

here-i-strand/
├── README.md
├── pyproject.toml
├── .env.example             # Example env vars (for your app)
│
├── his/                      # Main package
│   ├── __init__.py           # HISAgent, TimeoutConcurrentToolExecutor, event_loop_tracker, ping_status_task, write_dynamo
│   ├── his.py                # HISAgent, TimeoutConcurrentToolExecutor, ping, event_loop_tracker, write_dynamo
│   └── logging/
│       └── logging.py
│
└── tests/
    ├── conftest.py
    └── test_his.py

Main components

  • HISAgent: Strands agent with a DynamoDB ping thread and S3 sessions. You pass status_dynamo_table_name, bucket_name, session_id, and optionally name and agent_id so the ping and tracker use your table and bucket. Includes a default system prompt that enforces DynamoDB status reporting at key milestones. The write_dynamo tool is automatically added to the agent's tools.
  • TimeoutConcurrentToolExecutor: Tool executor with a per-invocation timeout (default: 300s); if a tool exceeds the limit, an error is returned and execution continues with the rest.
  • event_loop_tracker: Callback that writes event-loop milestones (init, start, message, result, force_stop) to DynamoDB along with agent_id and stops the ping when done.
  • write_dynamo: Strands tool for writing custom event records to DynamoDB for agent tracking and observability. Automatically included in HISAgent.
  • DEFAULT_DYNAMODB_REPORTING_PROMPT_TEMPLATE: Template for the default system prompt that instructs the agent to report status updates to DynamoDB at key milestones (start, tooling, completion, error). The template is populated with the actual table_name, session_id, and agent_id values when the agent is created.

Default behavior

When you create an HISAgent, the following happens automatically:

  1. System prompt: The DEFAULT_DYNAMODB_REPORTING_PROMPT is prepended to any custom system prompt you provide, instructing the agent to report status at key milestones.
  2. Tools: The write_dynamo tool is automatically added to your tools list, enabling the agent to write status updates to DynamoDB.
  3. Ping thread: A daemon thread starts that pings DynamoDB every 20 seconds with a "running" status until the agent completes.
  4. Event tracking: The event_loop_tracker callback records event-loop milestones to DynamoDB.

Tests

uv sync --all-groups
uv run pytest tests/ -v

Authors

License

MIT. See LICENSE.

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

here_i_strand-0.2.2.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

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

here_i_strand-0.2.2-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file here_i_strand-0.2.2.tar.gz.

File metadata

  • Download URL: here_i_strand-0.2.2.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for here_i_strand-0.2.2.tar.gz
Algorithm Hash digest
SHA256 c74c266defb36e74af6efa52a1d86c800d5f4cd4f8fae75ef2683859f938a972
MD5 0ca1a0b0765f8b590d4937c05210c287
BLAKE2b-256 651e1bdd1f4403ff431d0fc9f1f2b9945f997958b2da89665d733dbd1f259ba8

See more details on using hashes here.

File details

Details for the file here_i_strand-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: here_i_strand-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for here_i_strand-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 959d41fa2260f6aaa810eba8093dc5ca8fdea4d3d81b322ad3c4f1482a19c638
MD5 3a812c4b2dbfe718a7c4fa79a6e508e3
BLAKE2b-256 84c832e68a27921efa8e54ec86852324dd5fe6f6f8f10b3290cb98c1b4b5bb13

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