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
.envfile 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 passstatus_dynamo_table_name,bucket_name,session_id, and optionallynameandagent_idso the ping and tracker use your table and bucket. Includes a default system prompt that enforces DynamoDB status reporting at key milestones. Thewrite_dynamotool 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 withagent_idand stops the ping when done.write_dynamo: Strands tool for writing custom event records to DynamoDB for agent tracking and observability. Automatically included inHISAgent.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 actualtable_name,session_id, andagent_idvalues when the agent is created.
Default behavior
When you create an HISAgent, the following happens automatically:
- System prompt: The
DEFAULT_DYNAMODB_REPORTING_PROMPTis prepended to any custom system prompt you provide, instructing the agent to report status at key milestones. - Tools: The
write_dynamotool is automatically added to your tools list, enabling the agent to write status updates to DynamoDB. - Ping thread: A daemon thread starts that pings DynamoDB every 20 seconds with a "running" status until the agent completes.
- Event tracking: The
event_loop_trackercallback records event-loop milestones to DynamoDB.
Tests
uv sync --all-groups
uv run pytest tests/ -v
Authors
License
MIT. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 here_i_strand-0.2.0.tar.gz.
File metadata
- Download URL: here_i_strand-0.2.0.tar.gz
- Upload date:
- Size: 11.8 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
009b612910ac1693e4d27735ae1ca887e754f328d43ea4749ea897b2e58a0c3e
|
|
| MD5 |
64f2881ca24436799bb92d6aed1d4d60
|
|
| BLAKE2b-256 |
5baa765e09e895b70e4cd17cb9888dc8496d84c4e8fbc7bccf755fe40324fd43
|
File details
Details for the file here_i_strand-0.2.0-py3-none-any.whl.
File metadata
- Download URL: here_i_strand-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.8 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
077a6417f2591272872d74695e202f77b5348a68998312e679c03b5f953ce722
|
|
| MD5 |
8dc22477c1ba67b9c8234802efa853be
|
|
| BLAKE2b-256 |
f7d8ac23e31ca4fc03708f1fa5b0e28f8e16d7f14ee891ee559575d762c805e3
|