ai-functions  by strands-labs

Python SDK for reliable AI agentic workflows

Created 2 months ago
255 stars

Top 98.8% on SourcePulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

Summary

Strands AI Functions provides a Python library to build reliable AI-powered applications by abstracting AI agents as functions with enforced runtime post-conditions. It targets developers seeking to integrate AI capabilities into standard workflows without succumbing to non-determinism or instruction-following failures. The library offers a computational model that enhances expressivity, allowing tasks not easily coded traditionally, while ensuring correctness through self-correcting loops, thereby enabling robust and reusable agentic workflows.

How It Works

The core innovation is the "AI Function" abstraction, where standard Python functions are evaluated by reasoning AI agents. This approach addresses the inherent non-determinism of AI by implementing extensive runtime post-condition checking. Developers specify explicit conditions that function outputs must satisfy. The library automatically initiates self-correcting loops to guarantee these properties, preventing cascading errors. This enables AI Functions to leverage text generation and dynamically execute code for processing inputs into native Python objects.

Quick Start & Requirements

  • Installation: Use pip install strands-ai-functions or uv add strands-ai-functions.
  • Prerequisites: Python 3.12 or higher (3.14+ recommended). Valid credentials for a supported model provider (e.g., AWS Bedrock, OpenAI). The uv package manager is recommended for running provided examples.
  • Resources: A tutorial is available, and comprehensive examples are included within the repository's examples/ directory.

Highlighted Details

  • AI Functions support returning diverse data types, including primitives, Pydantic models, and native Python objects like Pandas DataFrames.
  • Facilitates the construction of multi-agent workflows and asynchronous agent graphs using asyncio.
  • Enables agents to access a local Python execution environment for data processing and manipulation.
  • AI Functions can be integrated as tools within other agents, enabling sophisticated multi-agent systems.

Maintenance & Community

The provided README does not detail specific community channels (e.g., Discord, Slack), notable contributors, sponsorships, or a public roadmap.

Licensing & Compatibility

The README does not explicitly state the project's license, which may impact commercial use or integration into closed-source projects.

Limitations & Caveats

The "local" code execution mode employs AST-based validation but lacks true sandboxing, posing risks of resource exhaustion (e.g., infinite loops, excessive memory). For production, running AI Functions within isolated environments like containers is strongly advised. The "disabled" mode is recommended for untrusted inputs or restricted environments, and careful monitoring of execution and limited imports are crucial.

Health Check
Last Commit

4 days ago

Responsiveness

Inactive

Pull Requests (30d)
1
Issues (30d)
0
Star History
49 stars in the last 30 days

Explore Similar Projects

Starred by Gagan Bansal Gagan Bansal(Coauthor of AutoGen; Research Scientist at Microsoft Research), Elvis Saravia Elvis Saravia(Founder of DAIR.AI), and
1 more.

agent-framework by microsoft

6.8%
9k
AI agent and multi-agent workflow framework
Created 11 months ago
Updated 1 day ago
Feedback? Help us improve.