ai-functions
ai-functions is a Python library that turns AI agents into checked functions, re-running them until results pass your rules, for developers building agent workflows.
What it is good for
- Getting reliable, verified answers from an AI agent in code
- Running several AI agents in parallel or as a team
- Making an AI workflow retry itself when its output is wrong
- Returning real Python data like tables from an AI agent
At a glance
- Who it is for
- Setup difficulty
- Developer ยท Requires programming
Level 5 of 5. You need to write code to use it.
- Cost
- Free and open source
- Type
- Framework or SDK
- Tasks
- Works with
- Amazon Bedrock, OpenAI, Claude Code, Kiro, Codex, Strands Agents
How to get started with ai-functions
- Install the library with
pip install strands-ai-functionsoruv add strands-ai-functions. - Set up credentials for a model provider; Amazon Bedrock is the default.
- Write a Python function with the
@ai_functiondecorator, a return type, and a docstring describing the task. - Add post-conditions so the result is checked and retried until it passes.
From the project's own documentation. If a step does not match what you see, the official pages have the latest instructions.
Before you try it
- Requires writing Python code to use.
- Defaults to Amazon Bedrock, so you need provider credentials or another model configured.
- Agents can generate and run code locally, so check the Security notes first.
- The proof-based verified module is under an experimental namespace.
Momentum
- Rank this week
- #36 in builder tools
- Best rank
- #36 week 46, 2026
- Stars gained last week
- +6
- GitHub stars
- 349
GitHub numbers as of Nov 16, 2026. Updated weekly.
Ranking history
Official links
Questions
- Is ai-functions free?
- Yes. It is free and open source (Apache-2.0 license).
- Do I need to know how to code to use ai-functions?
- Yes. You need to write code to use it.
- What does ai-functions work with?
- According to its own documentation, it works with Amazon Bedrock, OpenAI, Claude Code, Kiro, Codex, and Strands Agents.
- How do I get started with ai-functions?
- 1. Install the library with pip install strands-ai-functions or uv add strands-ai-functions. 2. Set up credentials for a model provider; Amazon Bedrock is the default. 3. Write a Python function with the @ai_function decorator, a return type, and a docstring describing the task. 4. Add post-conditions so the result is checked and retried until it passes.
- What should I know before trying ai-functions?
- Requires writing Python code to use. Defaults to Amazon Bedrock, so you need provider credentials or another model configured. Agents can generate and run code locally, so check the Security notes first. The proof-based verified module is under an experimental namespace.
- What is ai-functions good for?
- Getting reliable, verified answers from an AI agent in code, running several AI agents in parallel or as a team, making an AI workflow retry itself when its output is wrong, and returning real Python data like tables from an AI agent.
Similar agents to ai-functions
- Strands Agents
It is the base agent SDK this library builds on, without post-condition checks or proofs.
- crewAI
Focuses on role-based teams of agents rather than typed functions with verified outputs.
- LangChain
A broader framework for LLM apps, not centered on functions checked by post-conditions.
- Mozaik Network
Connects coding agents so they can message each other, without verified function outputs.
- AutoGen
A multi-agent framework that is archived and no longer maintained by Microsoft.
- headroom
headroom is a library and proxy that shrinks tool outputs, logs, and files before they reach the AI model, cutting token costs for coding agent users.