agentcompile 0.2.0__tar.gz → 0.2.1__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.
- agentcompile-0.2.1/.github/CODEOWNERS +1 -0
- agentcompile-0.2.1/.github/ISSUE_TEMPLATE/bug_report.yml +23 -0
- agentcompile-0.2.1/.github/ISSUE_TEMPLATE/config.yml +5 -0
- agentcompile-0.2.1/.github/ISSUE_TEMPLATE/feature_request.yml +9 -0
- agentcompile-0.2.1/.github/dependabot.yml +8 -0
- agentcompile-0.2.1/.github/pull_request_template.md +6 -0
- agentcompile-0.2.1/.release-please-manifest.json +1 -0
- agentcompile-0.2.1/CHANGELOG.md +15 -0
- agentcompile-0.2.1/CODE_OF_CONDUCT.md +7 -0
- agentcompile-0.2.1/CONTRIBUTING.md +22 -0
- {agentcompile-0.2.0 → agentcompile-0.2.1}/PKG-INFO +3 -1
- {agentcompile-0.2.0 → agentcompile-0.2.1}/README.md +2 -0
- agentcompile-0.2.1/SECURITY.md +18 -0
- {agentcompile-0.2.0 → agentcompile-0.2.1}/src/agentcompile/_core.py +1 -0
- {agentcompile-0.2.0 → agentcompile-0.2.1}/src/agentcompile/_decide.py +8 -2
- {agentcompile-0.2.0 → agentcompile-0.2.1}/src/agentcompile/_version.py +2 -2
- {agentcompile-0.2.0 → agentcompile-0.2.1}/tests/test_wrap.py +21 -0
- agentcompile-0.2.0/.release-please-manifest.json +0 -1
- agentcompile-0.2.0/CHANGELOG.md +0 -8
- {agentcompile-0.2.0 → agentcompile-0.2.1}/.github/workflows/ci.yml +0 -0
- {agentcompile-0.2.0 → agentcompile-0.2.1}/.github/workflows/release.yml +0 -0
- {agentcompile-0.2.0 → agentcompile-0.2.1}/.gitignore +0 -0
- {agentcompile-0.2.0 → agentcompile-0.2.1}/LICENSE +0 -0
- {agentcompile-0.2.0 → agentcompile-0.2.1}/pyproject.toml +0 -0
- {agentcompile-0.2.0 → agentcompile-0.2.1}/release-please-config.json +0 -0
- {agentcompile-0.2.0 → agentcompile-0.2.1}/src/agentcompile/__init__.py +0 -0
- {agentcompile-0.2.0 → agentcompile-0.2.1}/src/agentcompile/_anthropic.py +0 -0
- {agentcompile-0.2.0 → agentcompile-0.2.1}/src/agentcompile/_conversation.py +0 -0
- {agentcompile-0.2.0 → agentcompile-0.2.1}/src/agentcompile/_openai.py +0 -0
- {agentcompile-0.2.0 → agentcompile-0.2.1}/src/agentcompile/_payload.py +0 -0
- {agentcompile-0.2.0 → agentcompile-0.2.1}/src/agentcompile/_streams.py +0 -0
- {agentcompile-0.2.0 → agentcompile-0.2.1}/src/agentcompile/_trail.py +0 -0
- {agentcompile-0.2.0 → agentcompile-0.2.1}/src/agentcompile/cli.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @kbhatnagar1506
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: Something in the SDK doesn't work as documented
|
|
3
|
+
labels: [bug]
|
|
4
|
+
body:
|
|
5
|
+
- type: textarea
|
|
6
|
+
id: what
|
|
7
|
+
attributes:
|
|
8
|
+
label: What happened, and what did you expect?
|
|
9
|
+
validations: { required: true }
|
|
10
|
+
- type: textarea
|
|
11
|
+
id: repro
|
|
12
|
+
attributes:
|
|
13
|
+
label: Minimal code to reproduce
|
|
14
|
+
render: python
|
|
15
|
+
- type: input
|
|
16
|
+
id: versions
|
|
17
|
+
attributes:
|
|
18
|
+
label: Versions
|
|
19
|
+
placeholder: agentcompile 0.2.0, openai 2.x, Python 3.12
|
|
20
|
+
- type: textarea
|
|
21
|
+
id: trail
|
|
22
|
+
attributes:
|
|
23
|
+
label: Trail lines (`agentcompile trail --json`), with secrets removed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{".":"0.2.1"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.2.1](https://github.com/kbhatnagar1506/agentcompile-python/compare/v0.2.0...v0.2.1) (2026-10-01)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* keep AgentCompile's decision events in the trail ([#5](https://github.com/kbhatnagar1506/agentcompile-python/issues/5)) ([944c178](https://github.com/kbhatnagar1506/agentcompile-python/commit/944c178e5121f3389041335e36cee06a7f80e441))
|
|
9
|
+
|
|
10
|
+
## [0.2.0](https://github.com/kbhatnagar1506/agentcompile-python/compare/agentcompile-v0.1.0...agentcompile-v0.2.0) (2026-10-01)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* agentcompile --version ([c2fea67](https://github.com/kbhatnagar1506/agentcompile-python/commit/c2fea67a3bc9b23457a41545f19f94f8005583ce))
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Code of conduct
|
|
2
|
+
|
|
3
|
+
Be respectful and constructive. Harassment, personal attacks and discrimination of any kind are not welcome in issues, pull requests or any other project space.
|
|
4
|
+
|
|
5
|
+
Maintainers may edit or remove comments, and block contributors, who don't follow this.
|
|
6
|
+
|
|
7
|
+
Report problems to founders@tryagentcompile.com.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for helping. Issues and pull requests are welcome.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
pip install -e ".[dev]" ruff
|
|
9
|
+
pytest
|
|
10
|
+
ruff check src tests && ruff format --check src tests
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Pull requests
|
|
14
|
+
|
|
15
|
+
- One change per pull request, with a test.
|
|
16
|
+
- Commit messages follow [Conventional Commits](https://www.conventionalcommits.org): `fix: ...`, `feat: ...`, `docs: ...`, `chore: ...`. They decide the next version and the changelog.
|
|
17
|
+
- CI must pass on Python 3.9 and 3.13 before a pull request can merge.
|
|
18
|
+
- The SDK must stay safe in someone's live path: it never raises into the caller's agent, never edits the caller's prompts, and fails open.
|
|
19
|
+
|
|
20
|
+
## Releases
|
|
21
|
+
|
|
22
|
+
Maintainers merge the release pull request that release-please keeps open; that tags the release and publishes it to PyPI.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: agentcompile
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Wrap your agent's model client: repeated jobs run compiled, everything else goes to your model unchanged.
|
|
5
5
|
Project-URL: Homepage, https://tryagentcompile.com
|
|
6
6
|
Author-email: AgentCompile <founders@tryagentcompile.com>
|
|
@@ -25,6 +25,8 @@ Description-Content-Type: text/markdown
|
|
|
25
25
|
|
|
26
26
|
# agentcompile
|
|
27
27
|
|
|
28
|
+
[](https://pypi.org/project/agentcompile/) [](https://pypi.org/project/agentcompile/) [](https://github.com/kbhatnagar1506/agentcompile-python/actions/workflows/ci.yml) [](LICENSE)
|
|
29
|
+
|
|
28
30
|
```
|
|
29
31
|
pip install agentcompile
|
|
30
32
|
```
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# agentcompile
|
|
2
2
|
|
|
3
|
+
[](https://pypi.org/project/agentcompile/) [](https://pypi.org/project/agentcompile/) [](https://github.com/kbhatnagar1506/agentcompile-python/actions/workflows/ci.yml) [](LICENSE)
|
|
4
|
+
|
|
3
5
|
```
|
|
4
6
|
pip install agentcompile
|
|
5
7
|
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
## Reporting a vulnerability
|
|
4
|
+
|
|
5
|
+
Please don't open a public issue for security problems. Report them privately through **GitHub → Security → Report a vulnerability** on this repository, or email founders@tryagentcompile.com.
|
|
6
|
+
|
|
7
|
+
We'll acknowledge your report within 3 business days and keep you updated until it's fixed.
|
|
8
|
+
|
|
9
|
+
## How the SDK handles your data
|
|
10
|
+
|
|
11
|
+
- Your model provider key never leaves your process: the SDK calls your provider itself.
|
|
12
|
+
- To decide, the SDK sends the conversation's messages, system prompt, tool definitions and model name to AgentCompile, with your AgentCompile key. Nothing else from the request is sent.
|
|
13
|
+
- If AgentCompile fails, is slow or answers something unusable, your call goes straight to your model (fail-open).
|
|
14
|
+
- The trail is written only to a local file (`~/.agentcompile/trail.jsonl` by default) unless you pass `trail=False`.
|
|
15
|
+
|
|
16
|
+
## Supported versions
|
|
17
|
+
|
|
18
|
+
Security fixes go into the latest release.
|
|
@@ -65,6 +65,7 @@ class Router:
|
|
|
65
65
|
tool=decision.tool if decision else None,
|
|
66
66
|
reason=(decision.reason if decision and decision.action == "forward" else None)
|
|
67
67
|
or error,
|
|
68
|
+
events=list(decision.events) if decision and decision.events else None,
|
|
68
69
|
decide_ms=round(decide_ms, 1) if decide_ms is not None else None,
|
|
69
70
|
total_ms=round((time.perf_counter() - started) * 1000, 1),
|
|
70
71
|
stream=stream or None,
|
|
@@ -22,12 +22,17 @@ class Decision:
|
|
|
22
22
|
call_id: str | None = None
|
|
23
23
|
text: str | None = None
|
|
24
24
|
reason: str | None = None
|
|
25
|
+
# What AgentCompile decided along the way (which job, what it asked, why it handed
|
|
26
|
+
# off), as the server reported it: kept so the trail can show it.
|
|
27
|
+
events: tuple[dict[str, Any], ...] = ()
|
|
25
28
|
|
|
26
29
|
@classmethod
|
|
27
30
|
def parse(cls, body: Any) -> Decision | None:
|
|
28
31
|
if not isinstance(body, dict):
|
|
29
32
|
return None
|
|
30
33
|
action = body.get("action")
|
|
34
|
+
raw = body.get("events")
|
|
35
|
+
events = tuple(e for e in (raw if isinstance(raw, list) else []) if isinstance(e, dict))
|
|
31
36
|
if (
|
|
32
37
|
action == "tool_call"
|
|
33
38
|
and isinstance(body.get("tool"), str)
|
|
@@ -38,11 +43,12 @@ class Decision:
|
|
|
38
43
|
tool=body["tool"],
|
|
39
44
|
args=body["args"],
|
|
40
45
|
call_id=str(body.get("call_id") or ""),
|
|
46
|
+
events=events,
|
|
41
47
|
)
|
|
42
48
|
if action == "say" and isinstance(body.get("text"), str):
|
|
43
|
-
return cls(action, text=body["text"])
|
|
49
|
+
return cls(action, text=body["text"], events=events)
|
|
44
50
|
if action == "forward":
|
|
45
|
-
return cls(action, reason=str(body.get("reason") or ""))
|
|
51
|
+
return cls(action, reason=str(body.get("reason") or ""), events=events)
|
|
46
52
|
return None
|
|
47
53
|
|
|
48
54
|
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.2.
|
|
22
|
-
__version_tuple__ = version_tuple = (0, 2,
|
|
21
|
+
__version__ = version = '0.2.1'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 2, 1)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -169,6 +169,27 @@ def test_forward_calls_the_model_with_our_keyword_removed(tmp_path: Path) -> Non
|
|
|
169
169
|
assert event["route"] == "forwarded" and event["reason"] == "no job matched"
|
|
170
170
|
|
|
171
171
|
|
|
172
|
+
def test_the_trail_keeps_what_agentcompile_decided_along_the_way(tmp_path: Path) -> None:
|
|
173
|
+
events = [
|
|
174
|
+
{"decision": "activate_recipe", "recipe": "cancel_order"},
|
|
175
|
+
{"decision": "forward", "reason": "the customer asked a question"},
|
|
176
|
+
]
|
|
177
|
+
fake = Fake({**FORWARD, "events": events})
|
|
178
|
+
_openai(fake, tmp_path).chat.completions.create(
|
|
179
|
+
model="gpt-x", messages=MESSAGES, conversation_id="c1"
|
|
180
|
+
)
|
|
181
|
+
assert _trail(tmp_path)[0]["events"] == events
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def test_malformed_events_are_dropped_not_fatal(tmp_path: Path) -> None:
|
|
185
|
+
fake = Fake({**CALL, "events": ["not a dict", {"decision": "emit_read"}]})
|
|
186
|
+
_openai(fake, tmp_path).chat.completions.create(
|
|
187
|
+
model="gpt-x", messages=MESSAGES, conversation_id="c1"
|
|
188
|
+
)
|
|
189
|
+
event = _trail(tmp_path)[0]
|
|
190
|
+
assert event["route"] == "compiled" and event["events"] == [{"decision": "emit_read"}]
|
|
191
|
+
|
|
192
|
+
|
|
172
193
|
@pytest.mark.parametrize(
|
|
173
194
|
"fake",
|
|
174
195
|
[
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{".":"0.2.0"}
|
agentcompile-0.2.0/CHANGELOG.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [0.2.0](https://github.com/kbhatnagar1506/agentcompile-python/compare/agentcompile-v0.1.0...agentcompile-v0.2.0) (2026-10-01)
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
### Features
|
|
7
|
-
|
|
8
|
-
* agentcompile --version ([c2fea67](https://github.com/kbhatnagar1506/agentcompile-python/commit/c2fea67a3bc9b23457a41545f19f94f8005583ce))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|