open-agent-compiler 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. open_agent_compiler-0.1.0/.gitignore +42 -0
  2. open_agent_compiler-0.1.0/LICENSE +21 -0
  3. open_agent_compiler-0.1.0/PKG-INFO +155 -0
  4. open_agent_compiler-0.1.0/README.md +100 -0
  5. open_agent_compiler-0.1.0/pyproject.toml +90 -0
  6. open_agent_compiler-0.1.0/src/open_agent_compiler/__init__.py +62 -0
  7. open_agent_compiler-0.1.0/src/open_agent_compiler/_types.py +287 -0
  8. open_agent_compiler-0.1.0/src/open_agent_compiler/builders/__init__.py +17 -0
  9. open_agent_compiler-0.1.0/src/open_agent_compiler/builders/_base.py +15 -0
  10. open_agent_compiler-0.1.0/src/open_agent_compiler/builders/agent.py +227 -0
  11. open_agent_compiler-0.1.0/src/open_agent_compiler/builders/config.py +62 -0
  12. open_agent_compiler-0.1.0/src/open_agent_compiler/builders/skill.py +48 -0
  13. open_agent_compiler-0.1.0/src/open_agent_compiler/builders/subagent.py +49 -0
  14. open_agent_compiler-0.1.0/src/open_agent_compiler/builders/tool.py +240 -0
  15. open_agent_compiler-0.1.0/src/open_agent_compiler/builders/workflow_step.py +125 -0
  16. open_agent_compiler-0.1.0/src/open_agent_compiler/compiler.py +1367 -0
  17. open_agent_compiler-0.1.0/src/open_agent_compiler/managers/__init__.py +5 -0
  18. open_agent_compiler-0.1.0/src/open_agent_compiler/managers/_base.py +17 -0
  19. open_agent_compiler-0.1.0/src/open_agent_compiler/managers/opencode_server.py +30 -0
  20. open_agent_compiler-0.1.0/src/open_agent_compiler/predefined.py +143 -0
  21. open_agent_compiler-0.1.0/src/open_agent_compiler/py.typed +0 -0
  22. open_agent_compiler-0.1.0/src/open_agent_compiler/runtime.py +187 -0
  23. open_agent_compiler-0.1.0/src/open_agent_compiler/scripts/__init__.py +12 -0
  24. open_agent_compiler-0.1.0/src/open_agent_compiler/scripts/opencode_manager.py +581 -0
  25. open_agent_compiler-0.1.0/src/open_agent_compiler/scripts/subagent_todo.py +431 -0
  26. open_agent_compiler-0.1.0/src/open_agent_compiler/scripts/workspace_io.py +134 -0
  27. open_agent_compiler-0.1.0/src/open_agent_compiler/testing/__init__.py +46 -0
  28. open_agent_compiler-0.1.0/src/open_agent_compiler/testing/conversation.py +72 -0
  29. open_agent_compiler-0.1.0/src/open_agent_compiler/testing/conversation_runner.py +411 -0
  30. open_agent_compiler-0.1.0/src/open_agent_compiler/testing/llm_judge.py +217 -0
  31. open_agent_compiler-0.1.0/src/open_agent_compiler/testing/runner.py +419 -0
  32. open_agent_compiler-0.1.0/src/open_agent_compiler/testing/scenario.py +58 -0
  33. open_agent_compiler-0.1.0/src/open_agent_compiler/testing/tool_runner.py +60 -0
  34. open_agent_compiler-0.1.0/src/open_agent_compiler/writers/__init__.py +5 -0
  35. open_agent_compiler-0.1.0/src/open_agent_compiler/writers/_base.py +11 -0
  36. open_agent_compiler-0.1.0/src/open_agent_compiler/writers/opencode.py +236 -0
@@ -0,0 +1,42 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Distribution / packaging
7
+ dist/
8
+ build/
9
+ *.egg-info/
10
+ *.egg
11
+
12
+ # Virtual environments
13
+ .venv/
14
+ venv/
15
+
16
+ # IDE
17
+ .idea/
18
+ .vscode/
19
+ *.swp
20
+ *.swo
21
+
22
+ # Testing / coverage
23
+ .pytest_cache/
24
+ .coverage
25
+ htmlcov/
26
+ .benchmarks/
27
+
28
+ # mypy
29
+ .mypy_cache/
30
+
31
+ # ruff
32
+ .ruff_cache/
33
+
34
+ # Environment variables
35
+ .env
36
+ .env.*
37
+
38
+ # OS
39
+ .DS_Store
40
+ Thumbs.db
41
+
42
+ # uv — lockfile is committed for reproducible dev/CI installs
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ignacy Daszkiewicz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,155 @@
1
+ Metadata-Version: 2.4
2
+ Name: open-agent-compiler
3
+ Version: 0.1.0
4
+ Summary: Python-first agent framework that compiles agent definitions into backend-specific configurations
5
+ Project-URL: Homepage, https://github.com/DehydratedWater/OpenAgentCompiler
6
+ Project-URL: Repository, https://github.com/DehydratedWater/OpenAgentCompiler
7
+ Project-URL: Issues, https://github.com/DehydratedWater/OpenAgentCompiler/issues
8
+ Author: Ignacy Daszkiewicz
9
+ License: MIT License
10
+
11
+ Copyright (c) 2026 Ignacy Daszkiewicz
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ Keywords: agent,ai,compiler,framework,llm,opencode
32
+ Classifier: Development Status :: 3 - Alpha
33
+ Classifier: Intended Audience :: Developers
34
+ Classifier: License :: OSI Approved :: MIT License
35
+ Classifier: Programming Language :: Python :: 3
36
+ Classifier: Programming Language :: Python :: 3.12
37
+ Classifier: Programming Language :: Python :: 3.13
38
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
39
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
40
+ Classifier: Typing :: Typed
41
+ Requires-Python: >=3.12
42
+ Requires-Dist: pydantic>=2.0
43
+ Requires-Dist: python-dotenv
44
+ Provides-Extra: bench
45
+ Requires-Dist: pytest-benchmark>=4; extra == 'bench'
46
+ Provides-Extra: dev
47
+ Requires-Dist: mypy>=1.10; extra == 'dev'
48
+ Requires-Dist: pre-commit>=3; extra == 'dev'
49
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
50
+ Requires-Dist: pytest>=8; extra == 'dev'
51
+ Requires-Dist: ruff>=0.4; extra == 'dev'
52
+ Provides-Extra: testing
53
+ Requires-Dist: httpx>=0.27; extra == 'testing'
54
+ Description-Content-Type: text/markdown
55
+
56
+ # OpenAgentCompiler
57
+
58
+ Python-first agent framework that compiles agent definitions into backend-specific configurations for [OpenCode](https://github.com/opencode-ai/opencode) agents.
59
+
60
+ ## Installation
61
+
62
+ ```bash
63
+ pip install open-agent-compiler
64
+ ```
65
+
66
+ Or with [uv](https://docs.astral.sh/uv/):
67
+
68
+ ```bash
69
+ uv add open-agent-compiler
70
+ ```
71
+
72
+ For local/editable development:
73
+
74
+ ```bash
75
+ uv add --editable ../OpenAgentCompiler
76
+ ```
77
+
78
+ ## Quick start
79
+
80
+ ```python
81
+ from open_agent_compiler.builders import AgentBuilder, ConfigBuilder, ToolBuilder
82
+ from open_agent_compiler.compiler import compile_agent
83
+ from open_agent_compiler.writers import OpenCodeWriter
84
+ from open_agent_compiler._types import (
85
+ ModelConfig, ModelOptions, ProviderConfig, ProviderOptions,
86
+ )
87
+
88
+ # Define a tool
89
+ search = (
90
+ ToolBuilder()
91
+ .name("file-search")
92
+ .description("Search files by glob pattern")
93
+ .from_script("scripts/file_search.py")
94
+ .build()
95
+ )
96
+
97
+ # Configure the model
98
+ config = (
99
+ ConfigBuilder()
100
+ .provider(ProviderConfig(
101
+ name="anthropic",
102
+ options=ProviderOptions(api_key="env:ANTHROPIC_API_KEY"),
103
+ models=(ModelConfig(
104
+ name="sonnet",
105
+ id="claude-sonnet-4-5-20250929",
106
+ options=ModelOptions(temperature=0.0),
107
+ ),),
108
+ ))
109
+ .default_model("anthropic/sonnet")
110
+ .build()
111
+ )
112
+
113
+ # Build the agent
114
+ agent = (
115
+ AgentBuilder()
116
+ .name("my-agent")
117
+ .description("My custom agent")
118
+ .config(config)
119
+ .tool(search)
120
+ .system_prompt("You are a helpful assistant.")
121
+ .build()
122
+ )
123
+
124
+ # Compile and write to disk
125
+ compiled = compile_agent(agent, target="opencode")
126
+ OpenCodeWriter(output_dir="build/").write(compiled)
127
+ ```
128
+
129
+ ## Architecture
130
+
131
+ ```
132
+ Builder -> AgentDefinition -> Compiler -> backend dict -> Writer -> disk -> Manager -> external process
133
+ ```
134
+
135
+ - **Builders** -- Fluent API classes that produce immutable data types via `.build()`
136
+ - **Compiler** -- Transforms an `AgentDefinition` into a backend-specific dict
137
+ - **Writers** -- Persist compiled dicts to disk (project files, configs, scripts)
138
+ - **Managers** -- Async lifecycle managers that deploy/invoke/teardown agents
139
+
140
+ ## Development
141
+
142
+ ```bash
143
+ uv sync --all-extras # install with dev + bench deps
144
+ uv run pytest tests/ -v # run all tests
145
+ uv run ruff check . # lint
146
+ uv run mypy # type check
147
+ ```
148
+
149
+ ## Python version
150
+
151
+ Requires Python 3.12+.
152
+
153
+ ## License
154
+
155
+ See [LICENSE](LICENSE) for details.
@@ -0,0 +1,100 @@
1
+ # OpenAgentCompiler
2
+
3
+ Python-first agent framework that compiles agent definitions into backend-specific configurations for [OpenCode](https://github.com/opencode-ai/opencode) agents.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install open-agent-compiler
9
+ ```
10
+
11
+ Or with [uv](https://docs.astral.sh/uv/):
12
+
13
+ ```bash
14
+ uv add open-agent-compiler
15
+ ```
16
+
17
+ For local/editable development:
18
+
19
+ ```bash
20
+ uv add --editable ../OpenAgentCompiler
21
+ ```
22
+
23
+ ## Quick start
24
+
25
+ ```python
26
+ from open_agent_compiler.builders import AgentBuilder, ConfigBuilder, ToolBuilder
27
+ from open_agent_compiler.compiler import compile_agent
28
+ from open_agent_compiler.writers import OpenCodeWriter
29
+ from open_agent_compiler._types import (
30
+ ModelConfig, ModelOptions, ProviderConfig, ProviderOptions,
31
+ )
32
+
33
+ # Define a tool
34
+ search = (
35
+ ToolBuilder()
36
+ .name("file-search")
37
+ .description("Search files by glob pattern")
38
+ .from_script("scripts/file_search.py")
39
+ .build()
40
+ )
41
+
42
+ # Configure the model
43
+ config = (
44
+ ConfigBuilder()
45
+ .provider(ProviderConfig(
46
+ name="anthropic",
47
+ options=ProviderOptions(api_key="env:ANTHROPIC_API_KEY"),
48
+ models=(ModelConfig(
49
+ name="sonnet",
50
+ id="claude-sonnet-4-5-20250929",
51
+ options=ModelOptions(temperature=0.0),
52
+ ),),
53
+ ))
54
+ .default_model("anthropic/sonnet")
55
+ .build()
56
+ )
57
+
58
+ # Build the agent
59
+ agent = (
60
+ AgentBuilder()
61
+ .name("my-agent")
62
+ .description("My custom agent")
63
+ .config(config)
64
+ .tool(search)
65
+ .system_prompt("You are a helpful assistant.")
66
+ .build()
67
+ )
68
+
69
+ # Compile and write to disk
70
+ compiled = compile_agent(agent, target="opencode")
71
+ OpenCodeWriter(output_dir="build/").write(compiled)
72
+ ```
73
+
74
+ ## Architecture
75
+
76
+ ```
77
+ Builder -> AgentDefinition -> Compiler -> backend dict -> Writer -> disk -> Manager -> external process
78
+ ```
79
+
80
+ - **Builders** -- Fluent API classes that produce immutable data types via `.build()`
81
+ - **Compiler** -- Transforms an `AgentDefinition` into a backend-specific dict
82
+ - **Writers** -- Persist compiled dicts to disk (project files, configs, scripts)
83
+ - **Managers** -- Async lifecycle managers that deploy/invoke/teardown agents
84
+
85
+ ## Development
86
+
87
+ ```bash
88
+ uv sync --all-extras # install with dev + bench deps
89
+ uv run pytest tests/ -v # run all tests
90
+ uv run ruff check . # lint
91
+ uv run mypy # type check
92
+ ```
93
+
94
+ ## Python version
95
+
96
+ Requires Python 3.12+.
97
+
98
+ ## License
99
+
100
+ See [LICENSE](LICENSE) for details.
@@ -0,0 +1,90 @@
1
+ [project]
2
+ name = "open-agent-compiler"
3
+ version = "0.1.0"
4
+ description = "Python-first agent framework that compiles agent definitions into backend-specific configurations"
5
+ requires-python = ">=3.12"
6
+ readme = "README.md"
7
+ license = {file = "LICENSE"}
8
+ authors = [
9
+ {name = "Ignacy Daszkiewicz"},
10
+ ]
11
+ keywords = ["agent", "framework", "compiler", "opencode", "llm", "ai"]
12
+ classifiers = [
13
+ "Development Status :: 3 - Alpha",
14
+ "Intended Audience :: Developers",
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3.12",
17
+ "Programming Language :: Python :: 3.13",
18
+ "Topic :: Software Development :: Libraries :: Python Modules",
19
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Typing :: Typed",
22
+ ]
23
+ dependencies = [
24
+ "pydantic>=2.0",
25
+ "python-dotenv",
26
+ ]
27
+
28
+ [project.optional-dependencies]
29
+ dev = [
30
+ "pytest>=8",
31
+ "pytest-asyncio>=0.23",
32
+ "ruff>=0.4",
33
+ "mypy>=1.10",
34
+ "pre-commit>=3",
35
+ ]
36
+ bench = [
37
+ "pytest-benchmark>=4",
38
+ ]
39
+ testing = [
40
+ "httpx>=0.27",
41
+ ]
42
+
43
+ [project.urls]
44
+ Homepage = "https://github.com/DehydratedWater/OpenAgentCompiler"
45
+ Repository = "https://github.com/DehydratedWater/OpenAgentCompiler"
46
+ Issues = "https://github.com/DehydratedWater/OpenAgentCompiler/issues"
47
+
48
+ [build-system]
49
+ requires = ["hatchling"]
50
+ build-backend = "hatchling.build"
51
+
52
+ [tool.hatch.build.targets.wheel]
53
+ packages = ["src/open_agent_compiler"]
54
+
55
+ [tool.hatch.build.targets.sdist]
56
+ include = [
57
+ "src/",
58
+ "LICENSE",
59
+ "README.md",
60
+ "pyproject.toml",
61
+ ]
62
+
63
+ [tool.pytest.ini_options]
64
+ testpaths = ["tests"]
65
+ asyncio_mode = "auto"
66
+
67
+ [tool.ruff]
68
+ target-version = "py312"
69
+ src = ["src"]
70
+
71
+ [tool.ruff.lint]
72
+ select = ["E", "F", "W", "I", "UP", "B", "SIM", "RUF"]
73
+
74
+ [tool.ruff.lint.per-file-ignores]
75
+ # ScriptTool uses Generic[] for __orig_bases__ introspection — PEP 695 breaks it
76
+ "src/open_agent_compiler/runtime.py" = ["UP046"]
77
+ # Bundled scripts copied verbatim from v2 — not our code to lint
78
+ "src/open_agent_compiler/scripts/subagent_todo.py" = ["ALL"]
79
+ "src/open_agent_compiler/scripts/opencode_manager.py" = ["ALL"]
80
+
81
+ [tool.mypy]
82
+ python_version = "3.12"
83
+ strict = true
84
+ packages = ["open_agent_compiler"]
85
+ mypy_path = "src"
86
+
87
+ [[tool.mypy.overrides]]
88
+ # Bundled scripts copied verbatim from v2 — skip type checking
89
+ module = ["open_agent_compiler.scripts.subagent_todo", "open_agent_compiler.scripts.opencode_manager"]
90
+ ignore_errors = true
@@ -0,0 +1,62 @@
1
+ """OpenAgentCompiler — Python-first agent framework compiling to OpenCode agents."""
2
+
3
+ __version__ = "0.1.0"
4
+
5
+ from open_agent_compiler._types import (
6
+ ActionDefinition,
7
+ AgentPermissions,
8
+ CompactionConfig,
9
+ ConditionGate,
10
+ ConditionRoute,
11
+ Criterion,
12
+ MCPServerConfig,
13
+ ModelConfig,
14
+ ModelLimits,
15
+ ModelOptions,
16
+ ProviderConfig,
17
+ ProviderOptions,
18
+ StreamFormat,
19
+ SubagentDefinition,
20
+ ToolPermissions,
21
+ ToolUse,
22
+ UsageExample,
23
+ WorkflowStepDefinition,
24
+ )
25
+ from open_agent_compiler.compiler import compile_agent
26
+ from open_agent_compiler.predefined import (
27
+ agent_orchestration_skill,
28
+ opencode_manager_tool,
29
+ subagent_todo_skill,
30
+ subagent_todo_tool,
31
+ )
32
+ from open_agent_compiler.runtime import ScriptTool
33
+ from open_agent_compiler.writers import OpenCodeWriter
34
+
35
+ __all__ = [
36
+ "ActionDefinition",
37
+ "AgentPermissions",
38
+ "CompactionConfig",
39
+ "ConditionGate",
40
+ "ConditionRoute",
41
+ "Criterion",
42
+ "MCPServerConfig",
43
+ "ModelConfig",
44
+ "ModelLimits",
45
+ "ModelOptions",
46
+ "OpenCodeWriter",
47
+ "ProviderConfig",
48
+ "ProviderOptions",
49
+ "ScriptTool",
50
+ "StreamFormat",
51
+ "SubagentDefinition",
52
+ "ToolPermissions",
53
+ "ToolUse",
54
+ "UsageExample",
55
+ "WorkflowStepDefinition",
56
+ "__version__",
57
+ "agent_orchestration_skill",
58
+ "compile_agent",
59
+ "opencode_manager_tool",
60
+ "subagent_todo_skill",
61
+ "subagent_todo_tool",
62
+ ]