Python-first agent framework that compiles agent definitions into backend-specific configurations
Project description
OpenAgentCompiler
Python-first agent framework that compiles agent definitions into backend-specific configurations for OpenCode agents.
Installation
pip install open-agent-compiler
Or with uv:
uv add open-agent-compiler
For local/editable development:
uv add --editable ../OpenAgentCompiler
Quick start
from open_agent_compiler.builders import AgentBuilder, ConfigBuilder, ToolBuilder
from open_agent_compiler.compiler import compile_agent
from open_agent_compiler.writers import OpenCodeWriter
from open_agent_compiler._types import (
ModelConfig, ModelOptions, ProviderConfig, ProviderOptions,
)
# Define a tool
search = (
ToolBuilder()
.name("file-search")
.description("Search files by glob pattern")
.from_script("scripts/file_search.py")
.build()
)
# Configure the model
config = (
ConfigBuilder()
.provider(ProviderConfig(
name="anthropic",
options=ProviderOptions(api_key="env:ANTHROPIC_API_KEY"),
models=(ModelConfig(
name="sonnet",
id="claude-sonnet-4-5-20250929",
options=ModelOptions(temperature=0.0),
),),
))
.default_model("anthropic/sonnet")
.build()
)
# Build the agent
agent = (
AgentBuilder()
.name("my-agent")
.description("My custom agent")
.config(config)
.tool(search)
.system_prompt("You are a helpful assistant.")
.build()
)
# Compile and write to disk
compiled = compile_agent(agent, target="opencode")
OpenCodeWriter(output_dir="build/").write(compiled)
Architecture
Builder -> AgentDefinition -> Compiler -> backend dict -> Writer -> disk -> Manager -> external process
- Builders -- Fluent API classes that produce immutable data types via
.build() - Compiler -- Transforms an
AgentDefinitioninto a backend-specific dict - Writers -- Persist compiled dicts to disk (project files, configs, scripts)
- Managers -- Async lifecycle managers that deploy/invoke/teardown agents
Development
uv sync --all-extras # install with dev + bench deps
uv run pytest tests/ -v # run all tests
uv run ruff check . # lint
uv run mypy # type check
Python version
Requires Python 3.12+.
License
See LICENSE for details.
Project details
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_compiler-0.1.0.tar.gz.
File metadata
- Download URL: open_agent_compiler-0.1.0.tar.gz
- Upload date:
- Size: 46.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27296e1ef238c1415ce2be6ec0ffc58a6acdddcbcd355df6abbf38c368152ea9
|
|
| MD5 |
4095180eb2b9c4f6f5dfe53806f063ee
|
|
| BLAKE2b-256 |
6bf0cea243b6dcfc8d8b65b5d5169f0b8dbaeddde5e2528452493aaf2cd61d86
|
Provenance
The following attestation bundles were made for open_agent_compiler-0.1.0.tar.gz:
Publisher:
publish.yml on DehydratedWater/OpenAgentCompiler
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
open_agent_compiler-0.1.0.tar.gz -
Subject digest:
27296e1ef238c1415ce2be6ec0ffc58a6acdddcbcd355df6abbf38c368152ea9 - Sigstore transparency entry: 1188992698
- Sigstore integration time:
-
Permalink:
DehydratedWater/OpenAgentCompiler@b2926930956eb4c377e9721734a4da010c5c2312 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/DehydratedWater
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b2926930956eb4c377e9721734a4da010c5c2312 -
Trigger Event:
push
-
Statement type:
File details
Details for the file open_agent_compiler-0.1.0-py3-none-any.whl.
File metadata
- Download URL: open_agent_compiler-0.1.0-py3-none-any.whl
- Upload date:
- Size: 60.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9e180797a956a1970bedd7cbaafa7a7488f63cfc868301c285891c015bd73f0
|
|
| MD5 |
bd7f258dc601e7e990486120d9937a6f
|
|
| BLAKE2b-256 |
e2491dace8cc47aa47c45d7cc33ea64d00115a4a85606403d516429c561cd999
|
Provenance
The following attestation bundles were made for open_agent_compiler-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on DehydratedWater/OpenAgentCompiler
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
open_agent_compiler-0.1.0-py3-none-any.whl -
Subject digest:
a9e180797a956a1970bedd7cbaafa7a7488f63cfc868301c285891c015bd73f0 - Sigstore transparency entry: 1188992702
- Sigstore integration time:
-
Permalink:
DehydratedWater/OpenAgentCompiler@b2926930956eb4c377e9721734a4da010c5c2312 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/DehydratedWater
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b2926930956eb4c377e9721734a4da010c5c2312 -
Trigger Event:
push
-
Statement type: