AI Functions: Runtime Code Generation with Automated Verification

AI Functions is a new project from Strands Labs built on the Strands Agents SDK that enables runtime AI code generation with continuous automated verification. Instead of just generating text for humans to integrate, it produces code that runs inside your application at call time, returning native Python objects like DataFrames, Pydantic models, or database connections.
How AI Functions Work
The core abstraction is the @ai_function decorator. You write a Python function with a natural language specification in the docstring instead of implementation code. When the function is called, the decorator intercepts the call, constructs a prompt from the docstring (substituting arguments), sends it to an LLM, executes the generated code in your Python process, and returns the result as a native object.
Here's the basic example from the source:
from ai_functions import ai_function
@ai_function
def translate_text(text: str, lang: str) -> str:
"""
Translate the text below to the following language: {lang}.
{text}
"""
result = translate_text("The quarterly results exceeded expectations.", lang="French")
Key Differentiator: Automated Verification
The critical feature is post-conditions – plain Python assertions that define what correct output looks like. These execute on every function call, not just before deployment. If verification fails, the system automatically retries with the error as feedback. The human never inspects the generated code; the post-conditions handle verification every time.
Software 3.1 Concept
The article positions this as "Software 3.1" – an evolution from Andrej Karpathy's framework where Software 3.0 is "human prompts, LLM generates, human verifies." AI Functions represent "human specifies, LLM generates and executes, machine verifies – at runtime." The execution model differs fundamentally: the LLM isn't producing text for human integration but code that runs directly in your application.
This changes three aspects simultaneously: where AI fits in your software (runtime instead of just development time), what it produces (live objects you can call methods on instead of serialized text), and how you trust it (continuous automated verification instead of one-time human review).
📖 Read the full source: HN AI Agents
👀 See Also

tmux-IDE: A Terminal-Based Multi-Agent IDE for Claude
tmux-IDE is an open-source, declarative terminal IDE focused on agentic engineering that creates multi-agent layouts for Claude coding agents. It allows developers to boot into their IDE through SSH, give prompts to Claude, and close their machine while Claude continues working in tmux sessions.

context-link v1.0.0: Local MCP server reduces Claude Code token usage by 91%
context-link v1.0.0 is a local MCP server that indexes codebases with Tree-sitter to serve Claude only the exact symbols, dependencies and structure needed, reducing token usage by 91% in specific cases and 70-80% across full tasks.

Legal MCP Server for Claude Provides Access to 4M+ US Court Opinions
A free, open-source MCP server built with Claude Code gives Claude AI access to 4M+ real US court opinions, providing 18 tools for case law search, citation tracing, Bluebook parsing, Clio practice management, and PACER federal filings without hallucinations.

InsAIts Runtime Security Monitor for Claude Code Hits 8,000 PyPI Downloads
InsAIts, a runtime security monitor for Claude Code agentic sessions, has reached 8,140 total downloads on PyPI. Version 3.4.0 adds an Adaptive Context Manager, layered anchor injection system, and dashboard improvements.