Deterministic workflows of agents — a Docker-Compose-shaped YAML for composing LLM / code / model / tool nodes into a runnable flow.
Project description
Agent Compose
Deterministic workflows of agents. Agent Compose is a small engine for composing LLM agents, plain Python code, ML models, and tools into a single runnable flow, described in a Docker-Compose-shaped YAML file. You decide the structure; the LLMs fill the leaf boxes.
A flow is a function: it has typed input:, a graph of nodes:, and an output:.
The graph between nodes is inferred from the ${...} references — you never draw
edges by hand.
# hello.yaml
id: hello
name: hello
input:
name: str
nodes:
greet:
kind: agent
input:
name: ${input.name}
output: str
prompt: |-
Write a short, warm one-sentence greeting addressed to ${name}.
output: ${greet.output}
$ ac run hello.yaml --input name=Ada
Hello, Ada — it's wonderful to have you here!
Install
pip install agent-composer
Provider SDKs are optional extras — install the one(s) you use:
pip install "agent-composer[anthropic]" # Claude
pip install "agent-composer[openai]" # GPT
pip install "agent-composer[google]" # Gemini
pip install "agent-composer[ollama]" # local models
pip install "agent-composer[all]" # everything
The core (engine + CLI) installs with no provider SDK; importing a provider you
haven't installed raises a clear pip install agent-composer[...] hint.
The ac CLI
ac run FLOW.yaml [--input k=v]... [--inputs inputs.json] [--quiet]
--input k=v— set one input (repeatable). Values are coerced to each input's declared type.--inputs file.json— load inputs from a JSON object.--inputflags override individual keys.- Any required input still missing is prompted interactively.
- A flow that suspends on a
HUMAN_INPUT/WAITnode is resumed interactively — each pause prompts for the awaited value and the run continues to completion.
Choosing a provider/model
The default provider and model are read from the environment:
export AGENT_COMPOSE_DEFAULT_PROVIDER=anthropic # or openai / google / ollama
export AGENT_COMPOSE_DEFAULT_MODEL=claude-sonnet-4-5
export ANTHROPIC_API_KEY=... # provider's own key var
For a local Ollama endpoint:
export AGENT_COMPOSE_DEFAULT_PROVIDER=ollama
export AGENT_COMPOSE_DEFAULT_MODEL=llama3.2:3b
export OLLAMA_BASE_URL=http://localhost:11434
ac run examples/hello.yaml --input name=Ada
Examples
The examples/ directory ships a few generic flows:
hello.yaml— the smallest agent flow (one AGENT, string in/out).summarize.yaml— condense a block of text into one sentence.classify.yaml— label text with a constrainedLiteral[...]output.
Use it as a library
from agent_compose import load_flow, run_flow
loaded = load_flow(open("hello.yaml").read(), search_paths=["."])
result = run_flow(loaded, {"name": "Ada"})
print(result.status, result.output)
Develop & test
pip install -e ".[all,dev]"
pytest
Publish
Releases are published to PyPI automatically by GitHub Actions
(.github/workflows/publish.yml) whenever a
GitHub Release is published. It uses PyPI Trusted Publishing (OIDC), so no
API token or secret is stored in the repo.
One-time PyPI setup (https://pypi.org/manage/account/publishing/ → "Add a pending publisher"):
| Field | Value |
|---|---|
| PyPI Project Name | agent-composer |
| Owner | ngocbh |
| Repository name | agent_compose |
| Workflow name | publish.yml |
| Environment name | pypi |
To cut a release:
- Bump
versioninpyproject.toml, commit, and push tomain. - Tag and create a GitHub Release (e.g.
v0.0.2) — thepublishjob builds, tests, and uploads to PyPI.
Manual publish (fallback, needs an account-scoped API token):
pip install build twine
python -m build # wheel + sdist into dist/
twine upload dist/* # TWINE_USERNAME=__token__ TWINE_PASSWORD=pypi-...
License
Apache 2.0 — 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 agent_composer-0.0.1.tar.gz.
File metadata
- Download URL: agent_composer-0.0.1.tar.gz
- Upload date:
- Size: 165.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b6df496970bb792387e7c7c0a77715d0fad12fbc9f7cb25c80fdb18f363ff1d
|
|
| MD5 |
c9e1e0145a93e213c7b54a444852d7c8
|
|
| BLAKE2b-256 |
8b53c3a3d29f880489df76e41a2a1327adc3572907c59241e3bab96009a8a63d
|
Provenance
The following attestation bundles were made for agent_composer-0.0.1.tar.gz:
Publisher:
publish.yml on ngocbh/agent-composer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_composer-0.0.1.tar.gz -
Subject digest:
7b6df496970bb792387e7c7c0a77715d0fad12fbc9f7cb25c80fdb18f363ff1d - Sigstore transparency entry: 1984574944
- Sigstore integration time:
-
Permalink:
ngocbh/agent-composer@29b8388f41305aa2179218d8008d4563c77735fd -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/ngocbh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@29b8388f41305aa2179218d8008d4563c77735fd -
Trigger Event:
release
-
Statement type:
File details
Details for the file agent_composer-0.0.1-py3-none-any.whl.
File metadata
- Download URL: agent_composer-0.0.1-py3-none-any.whl
- Upload date:
- Size: 198.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a73d3b07efbaf8f6ac8b6805a139f90cdb0c31798f762aa94a913a4fe57cc47d
|
|
| MD5 |
8966b70fa27d40ab001e9fe3ee602c93
|
|
| BLAKE2b-256 |
6355cb2182fe36fdbdb144eb626be92bfd51a24a7bfffa5d47f2588105981a35
|
Provenance
The following attestation bundles were made for agent_composer-0.0.1-py3-none-any.whl:
Publisher:
publish.yml on ngocbh/agent-composer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_composer-0.0.1-py3-none-any.whl -
Subject digest:
a73d3b07efbaf8f6ac8b6805a139f90cdb0c31798f762aa94a913a4fe57cc47d - Sigstore transparency entry: 1984575123
- Sigstore integration time:
-
Permalink:
ngocbh/agent-composer@29b8388f41305aa2179218d8008d4563c77735fd -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/ngocbh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@29b8388f41305aa2179218d8008d4563c77735fd -
Trigger Event:
release
-
Statement type: