agentforge-oss 0.5.3__tar.gz → 0.5.4__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 (98) hide show
  1. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/CHANGELOG.md +44 -0
  2. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/PKG-INFO +18 -14
  3. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/README.md +15 -11
  4. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/_version.py +1 -1
  5. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/agents/base.py +10 -1
  6. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/cli/main.py +21 -0
  7. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/compliance/audit.py +76 -46
  8. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/config.py +25 -6
  9. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/orchestration/context.py +102 -1
  10. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/orchestration/orchestrator.py +23 -25
  11. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/security/sandbox.py +9 -0
  12. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/pyproject.toml +1 -1
  13. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_audit.py +6 -1
  14. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_audit_robustness.py +11 -0
  15. agentforge_oss-0.5.4/tests/test_budget_reservations.py +61 -0
  16. agentforge_oss-0.5.4/tests/test_cli.py +15 -0
  17. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_config_validation.py +19 -1
  18. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_ollama_provider.py +15 -0
  19. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_parallel_workers.py +1 -1
  20. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_security.py +19 -0
  21. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/.gitignore +0 -0
  22. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/LICENSE +0 -0
  23. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/docs/examples/custom-tools.md +0 -0
  24. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/docs/examples/index.md +0 -0
  25. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/docs/examples/otel-tracing.md +0 -0
  26. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/docs/examples/parallel-supervisor.md +0 -0
  27. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/docs/examples/persistent-rag.md +0 -0
  28. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/docs/examples/policy-governance.md +0 -0
  29. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/examples/enterprise_governance.py +0 -0
  30. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/examples/otel_tracing.py +0 -0
  31. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/examples/policy_governance.py +0 -0
  32. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/examples/quickstart.py +0 -0
  33. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/examples/rag.py +0 -0
  34. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/examples/rag_persistent.py +0 -0
  35. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/examples/rag_pgvector.py +0 -0
  36. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/examples/tool_use.py +0 -0
  37. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/__init__.py +0 -0
  38. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/agents/__init__.py +0 -0
  39. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/agents/agent.py +0 -0
  40. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/agents/supervisor.py +0 -0
  41. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/cli/__init__.py +0 -0
  42. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/cli/console.py +0 -0
  43. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/compliance/__init__.py +0 -0
  44. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/compliance/redaction.py +0 -0
  45. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/exceptions.py +0 -0
  46. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/governance/__init__.py +0 -0
  47. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/governance/policy.py +0 -0
  48. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/memory/__init__.py +0 -0
  49. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/memory/base.py +0 -0
  50. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/memory/conversation.py +0 -0
  51. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/memory/pgvector.py +0 -0
  52. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/memory/sqlite.py +0 -0
  53. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/memory/vector.py +0 -0
  54. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/models/__init__.py +0 -0
  55. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/models/base.py +0 -0
  56. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/models/providers/__init__.py +0 -0
  57. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/models/providers/anthropic.py +0 -0
  58. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/models/providers/bedrock.py +0 -0
  59. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/models/providers/echo.py +0 -0
  60. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/models/providers/ollama.py +0 -0
  61. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/models/providers/openai.py +0 -0
  62. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/models/registry.py +0 -0
  63. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/models/router.py +0 -0
  64. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/observability/__init__.py +0 -0
  65. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/observability/events.py +0 -0
  66. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/observability/logging.py +0 -0
  67. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/observability/otel.py +0 -0
  68. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/observability/usage.py +0 -0
  69. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/orchestration/__init__.py +0 -0
  70. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/py.typed +0 -0
  71. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/security/__init__.py +0 -0
  72. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/security/access.py +0 -0
  73. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/security/sanitization.py +0 -0
  74. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/tools/__init__.py +0 -0
  75. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/tools/base.py +0 -0
  76. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/tools/builtin/__init__.py +0 -0
  77. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/tools/builtin/calculator.py +0 -0
  78. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/tools/builtin/http.py +0 -0
  79. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/tools/builtin/time.py +0 -0
  80. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/tools/registry.py +0 -0
  81. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/forge/types.py +0 -0
  82. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/conftest.py +0 -0
  83. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_agents.py +0 -0
  84. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_bedrock_provider.py +0 -0
  85. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_config_security.py +0 -0
  86. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_http_security.py +0 -0
  87. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_memory.py +0 -0
  88. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_models.py +0 -0
  89. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_openai_provider.py +0 -0
  90. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_orchestrator.py +0 -0
  91. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_otel.py +0 -0
  92. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_pgvector_memory.py +0 -0
  93. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_policy_governance.py +0 -0
  94. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_sqlite_concurrency.py +0 -0
  95. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_sqlite_memory.py +0 -0
  96. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_streaming.py +0 -0
  97. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_tools.py +0 -0
  98. {agentforge_oss-0.5.3 → agentforge_oss-0.5.4}/tests/test_types.py +0 -0
@@ -8,6 +8,50 @@ Versioning follows [Semantic Versioning](https://semver.org/).
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [0.5.4] - 2026-08-12
12
+
13
+ Beta-hardening release. No new product features; imports, public API and CLI
14
+ commands are unchanged. One intentional behavior tightening is called out under
15
+ Changed below.
16
+
17
+ ### Security & governance
18
+ - `ToolSandbox` now enforces tool RBAC against the run principal: normal tools
19
+ require `USE_TOOL` and dangerous tools require `USE_DANGEROUS_TOOL`.
20
+ - Dangerous tools require **both** the `USE_DANGEROUS_TOOL` permission **and**
21
+ explicit allowlisting before they may run.
22
+
23
+ ### Budget reliability
24
+ - Added concurrent pre-call budget reservations (conservative input + maximum
25
+ output) held under a lock, reducing the risk of parallel workers collectively
26
+ oversubscribing a hard cap. Reservations settle against provider-reported
27
+ usage on success and are released on failure — no permanent reservation leak
28
+ and no double-counting. Costs remain local list-price estimates, not invoices.
29
+
30
+ ### Audit reliability
31
+ - Redact actor and run identifiers (in addition to resource values) before
32
+ writing audit records.
33
+ - Serialize in-process audit writes per audit file; `verify()` fails closed on
34
+ malformed/unparseable records. Multi-process audit-file coordination remains a
35
+ known limitation. Hash chains are tamper-evident, not immutable.
36
+
37
+ ### Configuration
38
+ - Stricter validation: reject unknown configuration fields, malformed boolean
39
+ environment values, non-positive tool timeouts, and invalid assignment.
40
+
41
+ ### CLI
42
+ - Added `forge --version` / `forge -V`. The existing `forge version` command is
43
+ unchanged.
44
+
45
+ ### Packaging
46
+ - Declare supported Python as `>=3.11,<3.14`.
47
+ - Pin the PyPI Trusted Publishing action to `pypa/gh-action-pypi-publish`
48
+ v1.14.2 (Twine 7 / Core Metadata 2.5 compatible).
49
+
50
+ ### Changed
51
+ - **Ollama is no longer auto-detected.** Zero-configuration runs stay
52
+ deterministic and offline (Echo). To enable the Ollama provider, set
53
+ `OLLAMA_BASE_URL` explicitly (for a local or remote server).
54
+
11
55
  ## [0.5.3] - 2026-08-06
12
56
 
13
57
  ### Maintenance
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: agentforge-oss
3
- Version: 0.5.3
3
+ Version: 0.5.4
4
4
  Summary: Forge — an open-source, enterprise-ready multi-agent orchestration platform with cost awareness, governance, and security built in.
5
5
  Project-URL: Homepage, https://github.com/sekacorn/AgentForge
6
6
  Project-URL: Documentation, https://github.com/sekacorn/AgentForge#readme
@@ -24,7 +24,7 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
24
  Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
25
25
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
26
  Classifier: Typing :: Typed
27
- Requires-Python: >=3.11
27
+ Requires-Python: <3.14,>=3.11
28
28
  Requires-Dist: httpx>=0.27
29
29
  Requires-Dist: pydantic>=2.6
30
30
  Requires-Dist: rich>=13.7
@@ -83,7 +83,7 @@ with cost-awareness, security, and compliance built in from line one.**
83
83
  [![CI](https://github.com/sekacorn/AgentForge/actions/workflows/ci.yml/badge.svg)](https://github.com/sekacorn/AgentForge/actions/workflows/ci.yml)
84
84
  [![PyPI](https://img.shields.io/pypi/v/agentforge-oss.svg)](https://pypi.org/project/agentforge-oss/)
85
85
  [![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-green.svg)](LICENSE)
86
- [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)](https://www.python.org/)
86
+ [![Python 3.11-3.13](https://img.shields.io/badge/python-3.11--3.13-blue.svg)](https://www.python.org/)
87
87
  [![Typed](https://img.shields.io/badge/typed-mypy%20strict-blue.svg)](pyproject.toml)
88
88
  [![Docs](https://img.shields.io/badge/docs-github%20pages-blue)](https://sekacorn.github.io/AgentForge/)
89
89
  [![Status: Beta](https://img.shields.io/badge/status-beta-orange.svg)](#whats-currently-shipped)
@@ -143,7 +143,7 @@ An honest snapshot of what works today versus what is on the way. Everything mar
143
143
  | Anthropic provider (Claude Haiku 4.5, Sonnet 4.6, Opus 4.8, Fable 5) | Shipped |
144
144
  | OpenAI provider (gpt-4o-mini, gpt-4o, gpt-4.1, o3) | Shipped |
145
145
  | Offline deterministic provider (zero config, no API key) | Shipped |
146
- | Ollama provider (local models, zero cost, no API key, auto-detected) | Shipped |
146
+ | Ollama provider (local models, zero cost, no API key, explicit opt-in) | Shipped |
147
147
  | Amazon Bedrock provider (Claude/Llama/Mistral via Converse, in-account/GovCloud) | Shipped |
148
148
  | Pre-flight + per-step budget caps | Shipped |
149
149
  | Tool sandboxing (allowlist/denylist, timeouts, dangerous-denied-by-default) | Shipped |
@@ -158,7 +158,7 @@ An honest snapshot of what works today versus what is on the way. Everything mar
158
158
  | Conversation memory + in-memory RAG vector store | Shipped |
159
159
  | Durable memory backend (SQLite, persistent RAG, no vector extension) | Shipped |
160
160
  | CLI (`forge run`, `forge models`, `forge audit`) | Shipped |
161
- | 115 tests, mypy strict, ruff clean, CI on 3.11 / 3.12 / 3.13 | Shipped |
161
+ | Offline-focused test suite, mypy strict, ruff clean, CI on 3.11 / 3.12 / 3.13 | Shipped |
162
162
  | Durable memory backend (pgvector, PostgreSQL + IVFFlat ANN, asyncpg) | Shipped |
163
163
  | Durable memory backends (Redis) | Planned |
164
164
  | Vertex / other cloud providers | Planned |
@@ -174,7 +174,7 @@ An honest snapshot of what works today versus what is on the way. Everything mar
174
174
  | One prompt, one answer, no division of labor | A supervisor decomposes the goal and delegates to specialized workers |
175
175
  | Workers run one at a time | Workers run in parallel — with a pre-flight budget check before any of them start |
176
176
  | Every call hits your most expensive model | Intelligent routing sends easy work to cheap models, hard work to frontier models |
177
- | Cost is a surprise on the invoice | Cost is tracked per run, per agent, per model — with hard budget caps |
177
+ | Cost is a surprise on the invoice | Cost is tracked per run, per agent, per model — with pre-call budget reservations |
178
178
  | Tools run with full trust | Tools run sandboxed, with side-effecting tools **denied by default** |
179
179
  | "Trust me, it worked" | A tamper-evident, hash-chained audit trail of every action |
180
180
  | Prototype you can't ship | A typed, tested core designed for production |
@@ -203,8 +203,10 @@ An honest snapshot of what works today versus what is on the way. Everything mar
203
203
  GPT-4.1, o3) and computes spend consistently.
204
204
  - **Budgets that bite — twice.** A pessimistic *pre-flight* check estimates the
205
205
  worst-case spend of a worker batch and refuses to start it if that would blow the
206
- remaining budget. A precise, real-time check then fires after every model call.
207
- Together they bound both over-spend and wasted API calls.
206
+ remaining budget. Before every model call, Forge also reserves conservative input
207
+ and maximum-output headroom, including across parallel workers; provider-reported
208
+ usage is checked after completion. Pricing is a local list-price estimate, not an
209
+ invoice guarantee.
208
210
 
209
211
  ### Tools, memory & RAG — extensible by design
210
212
  - **`@tool` decorator** turns any typed Python function into an agent tool, with
@@ -295,8 +297,8 @@ pip install "agentforge-oss[all,dev]" # everything + test/lint toolin
295
297
  > (configurable).
296
298
 
297
299
  > **Ollama support is built in** — no extra install needed (it uses `httpx`, already a
298
- > core dependency, so there is no `[ollama]` extra). Just run Ollama locally and Forge
299
- > auto-detects it (or set `OLLAMA_BASE_URL` for a custom/remote server):
300
+ > core dependency, so there is no `[ollama]` extra). Set `OLLAMA_BASE_URL` to opt in to
301
+ > using a local or remote Ollama server, then pull a model present in Forge's registry:
300
302
 
301
303
  ```bash
302
304
  ollama serve
@@ -503,6 +505,8 @@ questions already have answers.
503
505
  > Forge gives you strong application-level controls. It is not a substitute for OS-
504
506
  > level isolation when executing untrusted code — for that, run tools in a container
505
507
  > or microVM behind the same `ToolSandbox` interface. The design makes that a drop-in.
508
+ > Audit writes are serialized for logger instances in the same process; coordinating
509
+ > multiple processes that share one audit file remains an operator responsibility.
506
510
 
507
511
  ---
508
512
 
@@ -553,9 +557,9 @@ ruff check . # lint
553
557
  mypy forge # strict type-check
554
558
  ```
555
559
 
556
- The entire 115-test suite runs offline against the deterministic provider — fast,
557
- hermetic, and free. CI runs the same checks (ruff, ruff format, mypy strict, pytest)
558
- on Python 3.11, 3.12, and 3.13.
560
+ The test suite uses the deterministic provider for offline coverage; tests for
561
+ optional backends run when their extras are installed. CI runs Ruff, Ruff format,
562
+ mypy strict, and pytest on Python 3.11, 3.12, and 3.13.
559
563
 
560
564
  ---
561
565
 
@@ -10,7 +10,7 @@ with cost-awareness, security, and compliance built in from line one.**
10
10
  [![CI](https://github.com/sekacorn/AgentForge/actions/workflows/ci.yml/badge.svg)](https://github.com/sekacorn/AgentForge/actions/workflows/ci.yml)
11
11
  [![PyPI](https://img.shields.io/pypi/v/agentforge-oss.svg)](https://pypi.org/project/agentforge-oss/)
12
12
  [![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-green.svg)](LICENSE)
13
- [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)](https://www.python.org/)
13
+ [![Python 3.11-3.13](https://img.shields.io/badge/python-3.11--3.13-blue.svg)](https://www.python.org/)
14
14
  [![Typed](https://img.shields.io/badge/typed-mypy%20strict-blue.svg)](pyproject.toml)
15
15
  [![Docs](https://img.shields.io/badge/docs-github%20pages-blue)](https://sekacorn.github.io/AgentForge/)
16
16
  [![Status: Beta](https://img.shields.io/badge/status-beta-orange.svg)](#whats-currently-shipped)
@@ -70,7 +70,7 @@ An honest snapshot of what works today versus what is on the way. Everything mar
70
70
  | Anthropic provider (Claude Haiku 4.5, Sonnet 4.6, Opus 4.8, Fable 5) | Shipped |
71
71
  | OpenAI provider (gpt-4o-mini, gpt-4o, gpt-4.1, o3) | Shipped |
72
72
  | Offline deterministic provider (zero config, no API key) | Shipped |
73
- | Ollama provider (local models, zero cost, no API key, auto-detected) | Shipped |
73
+ | Ollama provider (local models, zero cost, no API key, explicit opt-in) | Shipped |
74
74
  | Amazon Bedrock provider (Claude/Llama/Mistral via Converse, in-account/GovCloud) | Shipped |
75
75
  | Pre-flight + per-step budget caps | Shipped |
76
76
  | Tool sandboxing (allowlist/denylist, timeouts, dangerous-denied-by-default) | Shipped |
@@ -85,7 +85,7 @@ An honest snapshot of what works today versus what is on the way. Everything mar
85
85
  | Conversation memory + in-memory RAG vector store | Shipped |
86
86
  | Durable memory backend (SQLite, persistent RAG, no vector extension) | Shipped |
87
87
  | CLI (`forge run`, `forge models`, `forge audit`) | Shipped |
88
- | 115 tests, mypy strict, ruff clean, CI on 3.11 / 3.12 / 3.13 | Shipped |
88
+ | Offline-focused test suite, mypy strict, ruff clean, CI on 3.11 / 3.12 / 3.13 | Shipped |
89
89
  | Durable memory backend (pgvector, PostgreSQL + IVFFlat ANN, asyncpg) | Shipped |
90
90
  | Durable memory backends (Redis) | Planned |
91
91
  | Vertex / other cloud providers | Planned |
@@ -101,7 +101,7 @@ An honest snapshot of what works today versus what is on the way. Everything mar
101
101
  | One prompt, one answer, no division of labor | A supervisor decomposes the goal and delegates to specialized workers |
102
102
  | Workers run one at a time | Workers run in parallel — with a pre-flight budget check before any of them start |
103
103
  | Every call hits your most expensive model | Intelligent routing sends easy work to cheap models, hard work to frontier models |
104
- | Cost is a surprise on the invoice | Cost is tracked per run, per agent, per model — with hard budget caps |
104
+ | Cost is a surprise on the invoice | Cost is tracked per run, per agent, per model — with pre-call budget reservations |
105
105
  | Tools run with full trust | Tools run sandboxed, with side-effecting tools **denied by default** |
106
106
  | "Trust me, it worked" | A tamper-evident, hash-chained audit trail of every action |
107
107
  | Prototype you can't ship | A typed, tested core designed for production |
@@ -130,8 +130,10 @@ An honest snapshot of what works today versus what is on the way. Everything mar
130
130
  GPT-4.1, o3) and computes spend consistently.
131
131
  - **Budgets that bite — twice.** A pessimistic *pre-flight* check estimates the
132
132
  worst-case spend of a worker batch and refuses to start it if that would blow the
133
- remaining budget. A precise, real-time check then fires after every model call.
134
- Together they bound both over-spend and wasted API calls.
133
+ remaining budget. Before every model call, Forge also reserves conservative input
134
+ and maximum-output headroom, including across parallel workers; provider-reported
135
+ usage is checked after completion. Pricing is a local list-price estimate, not an
136
+ invoice guarantee.
135
137
 
136
138
  ### Tools, memory & RAG — extensible by design
137
139
  - **`@tool` decorator** turns any typed Python function into an agent tool, with
@@ -222,8 +224,8 @@ pip install "agentforge-oss[all,dev]" # everything + test/lint toolin
222
224
  > (configurable).
223
225
 
224
226
  > **Ollama support is built in** — no extra install needed (it uses `httpx`, already a
225
- > core dependency, so there is no `[ollama]` extra). Just run Ollama locally and Forge
226
- > auto-detects it (or set `OLLAMA_BASE_URL` for a custom/remote server):
227
+ > core dependency, so there is no `[ollama]` extra). Set `OLLAMA_BASE_URL` to opt in to
228
+ > using a local or remote Ollama server, then pull a model present in Forge's registry:
227
229
 
228
230
  ```bash
229
231
  ollama serve
@@ -430,6 +432,8 @@ questions already have answers.
430
432
  > Forge gives you strong application-level controls. It is not a substitute for OS-
431
433
  > level isolation when executing untrusted code — for that, run tools in a container
432
434
  > or microVM behind the same `ToolSandbox` interface. The design makes that a drop-in.
435
+ > Audit writes are serialized for logger instances in the same process; coordinating
436
+ > multiple processes that share one audit file remains an operator responsibility.
433
437
 
434
438
  ---
435
439
 
@@ -480,9 +484,9 @@ ruff check . # lint
480
484
  mypy forge # strict type-check
481
485
  ```
482
486
 
483
- The entire 115-test suite runs offline against the deterministic provider — fast,
484
- hermetic, and free. CI runs the same checks (ruff, ruff format, mypy strict, pytest)
485
- on Python 3.11, 3.12, and 3.13.
487
+ The test suite uses the deterministic provider for offline coverage; tests for
488
+ optional backends run when their extras are installed. CI runs Ruff, Ruff format,
489
+ mypy strict, and pytest on Python 3.11, 3.12, and 3.13.
486
490
 
487
491
  ---
488
492
 
@@ -5,4 +5,4 @@ Hatchling reads ``__version__`` from this file at build time (see
5
5
  it for runtime access via ``forge.__version__``.
6
6
  """
7
7
 
8
- __version__ = "0.5.3"
8
+ __version__ = "0.5.4"
@@ -103,6 +103,12 @@ class BaseAgent(abc.ABC):
103
103
  provider = ctx.provider_for(decision.model)
104
104
  info = ctx.registry.get(decision.model)
105
105
  max_tokens = min(self.max_tokens, info.max_output_tokens)
106
+ reservation = await ctx.reserve_model_call(
107
+ model_name=decision.model,
108
+ messages=messages,
109
+ tools=tools,
110
+ max_output_tokens=max_tokens,
111
+ )
106
112
 
107
113
  ctx.events.emit(
108
114
  EventType.MODEL_CALL_STARTED,
@@ -121,6 +127,7 @@ class BaseAgent(abc.ABC):
121
127
  messages, model=decision.model, tools=tools, max_tokens=max_tokens
122
128
  )
123
129
  except Exception as exc:
130
+ await ctx.release_model_call(reservation)
124
131
  # Surface model/provider failures on the event stream (symmetric with
125
132
  # tool failures) before letting the error propagate and be audited.
126
133
  ctx.events.emit(
@@ -134,7 +141,9 @@ class BaseAgent(abc.ABC):
134
141
 
135
142
  # Pricing is resolved centrally from the registry, never the provider.
136
143
  response.usage.cost_usd = info.cost(response.usage)
137
- ctx.usage.record(response.usage, agent=self.name, model=decision.model)
144
+ await ctx.record_model_call(
145
+ reservation, response.usage, agent=self.name, model=decision.model
146
+ )
138
147
 
139
148
  ctx.events.emit(
140
149
  EventType.MODEL_CALL_FINISHED,
@@ -50,6 +50,27 @@ app = typer.Typer(
50
50
  console = Console()
51
51
 
52
52
 
53
+ def _show_version(value: bool) -> None:
54
+ """Print the installed version for the eager root CLI option."""
55
+ if value:
56
+ console.print(f"Forge (AgentForge) v{__version__}")
57
+ raise typer.Exit()
58
+
59
+
60
+ @app.callback()
61
+ def main(
62
+ version: bool = typer.Option(
63
+ False,
64
+ "--version",
65
+ "-V",
66
+ callback=_show_version,
67
+ is_eager=True,
68
+ help="Show the installed Forge version and exit.",
69
+ ),
70
+ ) -> None:
71
+ """Forge command-line interface."""
72
+
73
+
53
74
  @app.command()
54
75
  def run(
55
76
  goal: str = typer.Argument(..., help="The goal to accomplish, in plain language."),
@@ -14,6 +14,8 @@ from __future__ import annotations
14
14
 
15
15
  import hashlib
16
16
  import json
17
+ import threading
18
+ from dataclasses import dataclass
17
19
  from pathlib import Path
18
20
  from typing import Any
19
21
 
@@ -26,6 +28,18 @@ from forge.types import new_id, utcnow
26
28
  _log = get_logger("audit")
27
29
 
28
30
  _GENESIS = "0" * 64
31
+ _STATE_LOCK = threading.Lock()
32
+
33
+
34
+ @dataclass
35
+ class _AuditLogState:
36
+ """In-process state shared by loggers targeting one audit file."""
37
+
38
+ lock: threading.RLock
39
+ last_hash: str
40
+
41
+
42
+ _LOG_STATES: dict[Path, _AuditLogState] = {}
29
43
 
30
44
 
31
45
  class AuditEntry(BaseModel):
@@ -61,13 +75,13 @@ class AuditLogger:
61
75
  redactor: PIIRedactor | None = None,
62
76
  ) -> None:
63
77
  self.enabled = enabled
64
- self.path = Path(path)
78
+ self.path = Path(path).resolve()
65
79
  self._region = region
66
80
  self._redactor = redactor
67
- self._last_hash = _GENESIS
81
+ self._state = _AuditLogState(lock=threading.RLock(), last_hash=_GENESIS)
68
82
  if self.enabled:
69
83
  self.path.parent.mkdir(parents=True, exist_ok=True)
70
- self._last_hash = self._read_last_hash()
84
+ self._state = self._state_for_path(self.path)
71
85
 
72
86
  def record(
73
87
  self,
@@ -87,52 +101,57 @@ class AuditLogger:
87
101
  meta = dict(metadata)
88
102
  if self._redactor is not None:
89
103
  meta = self._redactor.redact_obj(meta)
104
+ actor = self._redactor.redact(actor)
90
105
  if resource is not None:
91
106
  resource = self._redactor.redact(resource)
92
-
93
- entry = AuditEntry(
94
- actor=actor,
95
- action=action,
96
- resource=resource,
97
- run_id=run_id,
98
- outcome=outcome,
99
- region=self._region,
100
- metadata=meta,
101
- previous_hash=self._last_hash,
102
- )
103
- entry.hash = self._compute_hash(entry)
104
-
105
- if self.enabled:
106
- with self.path.open("a", encoding="utf-8") as fh:
107
- fh.write(entry.model_dump_json() + "\n")
108
- self._last_hash = entry.hash
109
- return entry
107
+ if run_id is not None:
108
+ run_id = self._redactor.redact(run_id)
109
+
110
+ with self._state.lock:
111
+ entry = AuditEntry(
112
+ actor=actor,
113
+ action=action,
114
+ resource=resource,
115
+ run_id=run_id,
116
+ outcome=outcome,
117
+ region=self._region,
118
+ metadata=meta,
119
+ previous_hash=self._state.last_hash,
120
+ )
121
+ entry.hash = self._compute_hash(entry)
122
+
123
+ if self.enabled:
124
+ with self.path.open("a", encoding="utf-8") as fh:
125
+ fh.write(entry.model_dump_json() + "\n")
126
+ self._state.last_hash = entry.hash
127
+ return entry
110
128
 
111
129
  def verify(self) -> bool:
112
130
  """Re-read the log and confirm the hash chain is intact."""
113
- if not self.path.exists():
131
+ with self._state.lock:
132
+ if not self.path.exists():
133
+ return True
134
+ prev = _GENESIS
135
+ with self.path.open("r", encoding="utf-8") as fh:
136
+ for line_no, line in enumerate(fh, start=1):
137
+ line = line.strip()
138
+ if not line:
139
+ continue
140
+ try:
141
+ entry = AuditEntry.model_validate_json(line)
142
+ except ValueError:
143
+ # A line that no longer parses is itself tampering: fail closed
144
+ # (return False) rather than raising out of a bool-returning check.
145
+ _log.error("audit chain broken at line %d (unparseable record)", line_no)
146
+ return False
147
+ if entry.previous_hash != prev:
148
+ _log.error("audit chain broken at line %d (prev_hash mismatch)", line_no)
149
+ return False
150
+ if entry.hash != self._compute_hash(entry):
151
+ _log.error("audit chain broken at line %d (hash mismatch)", line_no)
152
+ return False
153
+ prev = entry.hash
114
154
  return True
115
- prev = _GENESIS
116
- with self.path.open("r", encoding="utf-8") as fh:
117
- for line_no, line in enumerate(fh, start=1):
118
- line = line.strip()
119
- if not line:
120
- continue
121
- try:
122
- entry = AuditEntry.model_validate_json(line)
123
- except ValueError:
124
- # A line that no longer parses is itself tampering: fail closed
125
- # (return False) rather than raising out of a bool-returning check.
126
- _log.error("audit chain broken at line %d (unparseable record)", line_no)
127
- return False
128
- if entry.previous_hash != prev:
129
- _log.error("audit chain broken at line %d (prev_hash mismatch)", line_no)
130
- return False
131
- if entry.hash != self._compute_hash(entry):
132
- _log.error("audit chain broken at line %d (hash mismatch)", line_no)
133
- return False
134
- prev = entry.hash
135
- return True
136
155
 
137
156
  @staticmethod
138
157
  def _compute_hash(entry: AuditEntry) -> str:
@@ -141,12 +160,23 @@ class AuditLogger:
141
160
  digest.update(entry.signing_payload().encode("utf-8"))
142
161
  return digest.hexdigest()
143
162
 
144
- def _read_last_hash(self) -> str:
145
- if not self.path.exists():
163
+ @classmethod
164
+ def _state_for_path(cls, path: Path) -> _AuditLogState:
165
+ """Return the shared in-process state for one normalized audit path."""
166
+ with _STATE_LOCK:
167
+ state = _LOG_STATES.get(path)
168
+ if state is None:
169
+ state = _AuditLogState(lock=threading.RLock(), last_hash=cls._read_last_hash(path))
170
+ _LOG_STATES[path] = state
171
+ return state
172
+
173
+ @staticmethod
174
+ def _read_last_hash(path: Path) -> str:
175
+ if not path.exists():
146
176
  return _GENESIS
147
177
  last = _GENESIS
148
178
  try:
149
- with self.path.open("r", encoding="utf-8") as fh:
179
+ with path.open("r", encoding="utf-8") as fh:
150
180
  for line in fh:
151
181
  line = line.strip()
152
182
  if line:
@@ -18,7 +18,7 @@ import tomllib
18
18
  from pathlib import Path
19
19
  from typing import Any, Literal
20
20
 
21
- from pydantic import BaseModel, Field, SecretStr
21
+ from pydantic import BaseModel, ConfigDict, Field, SecretStr
22
22
 
23
23
  from forge.exceptions import ConfigurationError
24
24
 
@@ -30,7 +30,14 @@ def _env_bool(name: str, default: bool) -> bool:
30
30
  raw = os.environ.get(name)
31
31
  if raw is None:
32
32
  return default
33
- return raw.strip().lower() in {"1", "true", "yes", "on"}
33
+ normalized = raw.strip().lower()
34
+ if normalized in {"1", "true", "yes", "on"}:
35
+ return True
36
+ if normalized in {"0", "false", "no", "off"}:
37
+ return False
38
+ raise ConfigurationError(
39
+ f"{name} must be a boolean value (true/false, yes/no, or 1/0), got {raw!r}"
40
+ )
34
41
 
35
42
 
36
43
  def _env_float(name: str) -> float | None:
@@ -58,6 +65,8 @@ class RoutingConfig(BaseModel):
58
65
  #: this from the available API keys when it is not set explicitly.
59
66
  default_provider: str | None = None
60
67
 
68
+ model_config = ConfigDict(extra="forbid", validate_assignment=True)
69
+
61
70
 
62
71
  class BudgetConfig(BaseModel):
63
72
  """Hard limits that keep an autonomous run from running away with spend."""
@@ -70,20 +79,24 @@ class BudgetConfig(BaseModel):
70
79
  #: Also bounds parallelism: subtasks run in concurrent batches of this size.
71
80
  max_workers: int = Field(default=5, ge=1)
72
81
 
82
+ model_config = ConfigDict(extra="forbid", validate_assignment=True)
83
+
73
84
 
74
85
  class SecurityConfig(BaseModel):
75
86
  """Guardrails applied to inputs and tool execution."""
76
87
 
77
88
  detect_prompt_injection: bool = True
78
89
  #: Inputs longer than this are rejected before reaching a model.
79
- max_input_chars: int = 200_000
90
+ max_input_chars: int = Field(default=200_000, ge=1)
80
91
  #: Per-tool execution timeout in seconds.
81
- tool_timeout_seconds: float = 30.0
92
+ tool_timeout_seconds: float = Field(default=30.0, gt=0)
82
93
  #: If set, only these tools may run (allowlist). ``None`` means "all".
83
94
  allow_tools: list[str] | None = None
84
95
  #: Tools that may never run (denylist), checked after the allowlist.
85
96
  block_tools: list[str] = Field(default_factory=list)
86
97
 
98
+ model_config = ConfigDict(extra="forbid", validate_assignment=True)
99
+
87
100
 
88
101
  class ComplianceConfig(BaseModel):
89
102
  """Settings that support audit, governance and data-privacy requirements."""
@@ -97,6 +110,8 @@ class ComplianceConfig(BaseModel):
97
110
  #: Optional retention window, surfaced to operators (enforcement is external).
98
111
  retention_days: int | None = None
99
112
 
113
+ model_config = ConfigDict(extra="forbid", validate_assignment=True)
114
+
100
115
 
101
116
  class ObservabilityConfig(BaseModel):
102
117
  """Logging and tracing behaviour."""
@@ -105,6 +120,8 @@ class ObservabilityConfig(BaseModel):
105
120
  #: Emit logs as JSON lines (recommended for production log aggregation).
106
121
  json_logs: bool = False
107
122
 
123
+ model_config = ConfigDict(extra="forbid", validate_assignment=True)
124
+
108
125
 
109
126
  class ForgeConfig(BaseModel):
110
127
  """Top-level configuration object passed to the :class:`Orchestrator`."""
@@ -117,8 +134,8 @@ class ForgeConfig(BaseModel):
117
134
  #: Provider name -> API key. Populated from the environment by default.
118
135
  api_keys: dict[str, SecretStr] = Field(default_factory=dict)
119
136
  #: Base URL of a local Ollama server (overridable via ``OLLAMA_BASE_URL``). The
120
- #: orchestrator offers the Ollama provider when this is set explicitly or when a
121
- #: server is reachable here; see ``Orchestrator._build_default_providers``.
137
+ #: orchestrator offers the Ollama provider when ``OLLAMA_BASE_URL`` is set
138
+ #: explicitly; see ``Orchestrator._build_default_providers``.
122
139
  ollama_base_url: SecretStr = SecretStr("http://localhost:11434")
123
140
  #: Retrieval-memory backend (see ``forge.memory.build_memory``). ``"sqlite"``
124
141
  #: persists RAG state across restarts and needs the optional ``aiosqlite`` extra.
@@ -139,6 +156,8 @@ class ForgeConfig(BaseModel):
139
156
  #: AWS named profile for the Bedrock provider (from ``AWS_PROFILE``).
140
157
  bedrock_profile: str | None = None
141
158
 
159
+ model_config = ConfigDict(extra="forbid", validate_assignment=True)
160
+
142
161
  @classmethod
143
162
  def load(cls, path: str | Path | None = None) -> ForgeConfig:
144
163
  """Build a config from (optional) TOML file overlaid with environment.