YAML-first agent specs: run with `oa run` or generate a full Python project with `oa init`.
Project description
Open Agent Spec (OA)
Define AI agents as contracts, not scattered prompts.
Open Agent Spec lets you define an agent once in YAML, validate inputs and outputs against a schema, and either run it directly with oa run or generate a Python scaffold with oa init.
Why This Exists
Most agent systems are hard to reason about:
- outputs are not strictly typed
- behaviour is buried in prompts
- logic is split across Python, Markdown, and framework abstractions
- swapping models often breaks things in subtle ways
The Idea
Open Agent Spec treats an agent like infrastructure.
Think OpenAPI or Terraform, but for AI agents.
You define:
- input schema
- output schema
- prompts
- model configuration
Then OA enforces the boundary:
input -> LLM -> validated output
If the output does not match schema, the task fails fast with a validation error.
For example, this shape mismatch can silently break downstream systems:
{"msg":"hello"}
instead of:
{"response":"hello"}
Super Quick Start
Install (Python 3.10+):
pipx install open-agent-spec
oa init aac
oa validate aac
export OPENAI_API_KEY=your_key_here
oa run --spec .agents/example.yaml --task greet --input '{"name":"Alice"}' --quiet
With OA you can:
- define tasks, prompts, model config, and expected I/O in YAML
- run a spec directly without generating code first
- keep
.agents/*.yamlin your repo and call them from CI - generate a Python project scaffold when you want to customize implementation
First Run
Shortest path from install to a working agent:
1. Create the agents-as-code layout (aac = repo-native .agents/ directory):
oa init aac
This creates:
.agents/
├── example.yaml # minimal hello-world spec
├── review.yaml # code-review agent that accepts a diff file
└── README.md # quick usage notes
2. Validate the generated specs:
oa validate aac
3. Set an API key for the engine in your spec (OpenAI by default):
export OPENAI_API_KEY=your_key_here
4. Run the example agent:
oa run --spec .agents/example.yaml --task greet --input '{"name":"Alice"}' --quiet
--quiet prints the task output JSON only, good for piping to jq or scripting:
{
"response": "Hello Alice!"
}
Omit --quiet for the full execution envelope with Rich formatting.
5. Try the review agent on a local diff:
git diff > change.diff
oa run --spec .agents/review.yaml --task review --input change.diff --quiet
Write Your Own Spec
Start from this shape:
open_agent_spec: "1.2.8"
agent:
name: hello-world-agent
role: chat
intelligence:
type: llm
engine: openai
model: gpt-4o
tasks:
greet:
description: Say hello to someone
input:
type: object
properties:
name:
type: string
required: [name]
output:
type: object
properties:
response:
type: string
required: [response]
prompts:
system: >
You greet people by name.
user: "{{ name }}"
Validate first, then run:
oa validate --spec agent.yaml
oa run --spec agent.yaml --task greet --input '{"name":"Alice"}' --quiet
Generate a Python Scaffold
If you want editable generated code instead of running the YAML directly:
oa init --spec agent.yaml --output ./agent
Generated structure:
agent/
├── agent.py
├── models.py
├── prompts/
├── requirements.txt
├── .env.example
└── README.md
Core Idea
Most agent projects end up hand-rolling the same pieces:
- prompt templates
- model configuration
- task definitions
- routing glue
- runtime wrappers
OA moves those concerns into a declarative spec so they can be reviewed, versioned, and reused.
The intended model is:
- spec defines the agent contract
oa runexecutes the spec directlyoa initgenerates a starting implementation when you need code- external systems can orchestrate multiple specs however they want
OA deliberately does not prescribe:
- orchestration
- evaluation
- governance
- long-running runtime architecture
Common Commands
| Command | Purpose |
|---|---|
oa init aac |
Create .agents/ with starter specs |
oa validate aac |
Validate all specs in .agents/ |
oa validate --spec agent.yaml |
Validate one spec |
oa run --spec agent.yaml --task greet --input '{"name":"Alice"}' --quiet |
Run one task directly from YAML |
oa init --spec agent.yaml --output ./agent |
Generate a Python scaffold |
oa update --spec agent.yaml --output ./agent |
Regenerate an existing scaffold |
More Detail
| Resource | Contents |
|---|---|
| openagentspec.dev | Project website |
| docs/REFERENCE.md | Spec structure, engines, templates, .agents/ usage |
| Repository | Source, issues, workflows |
Notes
- The CLI command is
oa(notoas). - Python 3.10+ is required.
oa runrequires the relevant provider API key for the engine in your spec.
About
- OA Open Agent Spec was dreamed up by Andrew Whitehouse in late 2024, with a desire to give structure and standardiasation to early agent systems
- In early 2025 Prime Vector was formed taking over the public facing project
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 open_agent_spec-1.2.8.tar.gz.
File metadata
- Download URL: open_agent_spec-1.2.8.tar.gz
- Upload date:
- Size: 85.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4c6d8619dd30603ad2dcaf94c9c91841d5110c2a5cfb88d5b88b1b5f269bbf1
|
|
| MD5 |
ce3213e8444b036818213537a925447a
|
|
| BLAKE2b-256 |
f0534afd2ba4e7a05ec33b4712806ed58237e565b8ab2ac505b94eef2d3ddcf9
|
File details
Details for the file open_agent_spec-1.2.8-py3-none-any.whl.
File metadata
- Download URL: open_agent_spec-1.2.8-py3-none-any.whl
- Upload date:
- Size: 62.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e71ee20f9ef4284f2f94f1e9fce5fc95c3d3637d88730111a2329f00d5b51c5
|
|
| MD5 |
dfe8a6373c145c850a4265353b6b6079
|
|
| BLAKE2b-256 |
74ffc79ed6f7c363200178aa9d541f930efe7c87984d3182e9512ec0e34d2097
|