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

iknowkungfu Skill Analyzes OpenClaw Usage to Recommend Missing Skills
iknowkungfu is a new OpenClaw skill that scans your agent's workspace, memory files, and conversation logs to identify what skills you're missing based on your actual usage patterns. It provides specific recommendations with trust scores and reasons tied to your workflow.

Running Multiple Claude Code Sessions in Parallel with Git Worktrees
A developer shares how they use git worktrees to run multiple Claude Code sessions on separate branches without stashing or context switching. Review diffs, merge, and move on.

Lemonade by AMD: Open Source Local LLM Server for GPU and NPU
Lemonade is an open source local AI server that runs text, image, and speech models on GPUs and NPUs. It's OpenAI API compatible, supports multiple models simultaneously, and has a 2MB native C++ backend.

AutoProber: AI-driven flying probe automation for hardware hacking
AutoProber is a hardware hacker's flying probe automation stack that enables AI agents to discover targets, map microscope images, perform safety-monitored CNC motion, review probes, and conduct controlled pin probing. It includes Python control code, a web dashboard, CAD files, and operates with GRBL CNC controllers, USB microscopes, and oscilloscope safety monitoring.