Open Agent Spec (OA)
Define an AI agent once in YAML, then run it directly with oa run or generate a Python scaffold with oa init.
OA is a spec-first CLI for developers who want agent behavior to live in source control — not spread across prompts, scripts, and framework glue. Think OpenAPI, but for agents.
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
Quick Start
Install (Python 3.10+):
pipx install open-agent-spec
Alternative: pip
pip install open-agent-spec
Verify:
oa --version
oa --help
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.7"
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
You can also start from the bundled template:
oa init --template minimal --output ./agent
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 init --template minimal --output ./agent |
Generate from bundled template |
oa update --spec agent.yaml --output ./agent |
Regenerate an existing scaffold |
More Detail
| Resource | Contents |
|---|---|
| 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.
License
MIT — see LICENSE.
Metadata
Release files for open-agent-spec 1.2.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| open_agent_spec-1.2.7.tar.gz | 85.6 MB | Without provenance | Details for open_agent_spec-1.2.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| open_agent_spec-1.2.7-py3-none-any.whl | Python 3 | none | any | Details for open_agent_spec-1.2.7-py3-none-any.whl |
Total release size: 85.7 MB
Release files / open_agent_spec-1.2.7.tar.gz
| Download URL | open_agent_spec-1.2.7.tar.gz |
|---|---|
| Size | 85.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b0de50440e2f53968d05615173090ab311490a67f36eb9c1c8b3eea9b6275ea7
|
|
BLAKE2b-256 checksum How to use checksums |
75561ff55f746c0449f5eba0c7ca2edbba54c6577e6b0fe13e9d61999d0fa4fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.5
|
Release files / open_agent_spec-1.2.7-py3-none-any.whl
| Download URL | open_agent_spec-1.2.7-py3-none-any.whl |
|---|---|
| Size | 62.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
69d759246c8d2acaf97ab6ff9937407b05e6c4515d0f879bb0b42cc76654882c
|
|
BLAKE2b-256 checksum How to use checksums |
5fb4be5260ec4e5820c9678393689b2e445fe2894ac58f88dab442ff2c0588f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.5
|
Security for open-agent-spec 1.2.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.