agentforge-oss 0.5.1__tar.gz → 0.5.2__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.
- agentforge_oss-0.5.2/CHANGELOG.md +93 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/LICENSE +1 -1
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/PKG-INFO +10 -5
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/README.md +2 -2
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/_version.py +1 -1
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/memory/pgvector.py +20 -7
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/observability/events.py +4 -3
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/tools/builtin/http.py +9 -1
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/pyproject.toml +12 -4
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_pgvector_memory.py +5 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/.gitignore +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/docs/examples/custom-tools.md +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/docs/examples/index.md +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/docs/examples/otel-tracing.md +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/docs/examples/parallel-supervisor.md +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/docs/examples/persistent-rag.md +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/docs/examples/policy-governance.md +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/examples/enterprise_governance.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/examples/otel_tracing.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/examples/policy_governance.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/examples/quickstart.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/examples/rag.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/examples/rag_persistent.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/examples/rag_pgvector.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/examples/tool_use.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/__init__.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/agents/__init__.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/agents/agent.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/agents/base.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/agents/supervisor.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/cli/__init__.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/cli/console.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/cli/main.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/compliance/__init__.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/compliance/audit.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/compliance/redaction.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/config.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/exceptions.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/governance/__init__.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/governance/policy.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/memory/__init__.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/memory/base.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/memory/conversation.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/memory/sqlite.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/memory/vector.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/models/__init__.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/models/base.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/models/providers/__init__.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/models/providers/anthropic.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/models/providers/bedrock.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/models/providers/echo.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/models/providers/ollama.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/models/providers/openai.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/models/registry.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/models/router.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/observability/__init__.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/observability/logging.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/observability/otel.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/observability/usage.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/orchestration/__init__.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/orchestration/context.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/orchestration/orchestrator.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/py.typed +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/security/__init__.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/security/access.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/security/sandbox.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/security/sanitization.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/tools/__init__.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/tools/base.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/tools/builtin/__init__.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/tools/builtin/calculator.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/tools/builtin/time.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/tools/registry.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/forge/types.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/conftest.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_agents.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_audit.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_audit_robustness.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_bedrock_provider.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_config_security.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_config_validation.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_http_security.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_memory.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_models.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_ollama_provider.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_openai_provider.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_orchestrator.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_otel.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_parallel_workers.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_policy_governance.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_security.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_sqlite_concurrency.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_sqlite_memory.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_streaming.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_tools.py +0 -0
- {agentforge_oss-0.5.1 → agentforge_oss-0.5.2}/tests/test_types.py +0 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Forge are documented here.
|
|
4
|
+
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
5
|
+
Versioning follows [Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## [Unreleased]
|
|
10
|
+
|
|
11
|
+
### Maintenance
|
|
12
|
+
- Consolidated git commit authorship under a single maintainer identity (`sekacorn`).
|
|
13
|
+
|
|
14
|
+
## [0.5.2] — 2026-07-07
|
|
15
|
+
|
|
16
|
+
### Release infrastructure
|
|
17
|
+
- Reconnected release metadata for the recreated `sekacorn/AgentForge` repository.
|
|
18
|
+
- Updated package metadata to publish public author identity as `sekacorn`.
|
|
19
|
+
- Restored the dedicated GitHub Actions release workflow for PyPI Trusted Publishing.
|
|
20
|
+
- Added distribution validation and artifact handoff before publishing.
|
|
21
|
+
|
|
22
|
+
### Documentation
|
|
23
|
+
- Replaced stale version-specific shipped-feature wording with current release language.
|
|
24
|
+
|
|
25
|
+
## [0.5.1] — 2026-07-05
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
- PGVectorMemoryStore: durable RAG backend using PostgreSQL + pgvector with IVFFlat ANN indexing (cosine distance), asyncpg connection pool
|
|
29
|
+
- FORGE_PGVECTOR_DSN config for PostgreSQL connection string
|
|
30
|
+
- New extra: `pip install "agentforge-oss[pgvector]"` (asyncpg + pgvector-python)
|
|
31
|
+
- New example: examples/rag_pgvector.py
|
|
32
|
+
|
|
33
|
+
## [0.5.0] — 2026-07-01
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
- Policy-as-code governance: PolicyRule, PolicySet, PolicyDecision -- define deny/approve/log rules evaluated before every tool call
|
|
37
|
+
- Human-in-the-loop approval gates: async approver callbacks pause execution for human sign-off
|
|
38
|
+
- Four new event types: POLICY_EVALUATED, POLICY_APPROVED, POLICY_DENIED, POLICY_LOGGED
|
|
39
|
+
- New example: examples/policy_governance.py
|
|
40
|
+
|
|
41
|
+
## [0.4.0] — 2026-06-30
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
- Amazon Bedrock provider: Claude 3.5 Haiku/Sonnet, Llama 3.1 70B/405B, Mistral Large via the unified Converse API
|
|
45
|
+
- Standard AWS credential chain (env vars, profile, IAM role) — no custom credential handling
|
|
46
|
+
- Native streaming via converse_stream()
|
|
47
|
+
|
|
48
|
+
## [0.3.0] — 2026-06-29
|
|
49
|
+
|
|
50
|
+
### Added
|
|
51
|
+
- Ollama provider: local LLM execution via Ollama REST API (llama3.2:3b, llama3.1:8b, llama3.1:70b, mistral:7b, qwen2.5:7b, deepseek-r1:8b) — zero cost, no API key, air-gap compatible
|
|
52
|
+
- Native streaming support in OllamaProvider (newline-delimited JSON stream)
|
|
53
|
+
- OLLAMA_BASE_URL configuration with automatic reachability detection
|
|
54
|
+
- SQLiteMemoryStore: persistent RAG backend using stdlib sqlite3 + aiosqlite, zero external vector extension required
|
|
55
|
+
- FORGE_MEMORY_BACKEND=sqlite config to enable persistence across restarts
|
|
56
|
+
- New example: examples/rag_persistent.py
|
|
57
|
+
- OpenTelemetry export: traces (forge.run, forge.agent, forge.model_call, forge.tool_call spans) and metrics (runs, duration, tokens, tool calls) via opentelemetry-sdk
|
|
58
|
+
- ConsoleSpanExporter by default (zero infra), OTLP endpoint for production
|
|
59
|
+
- FORGE_OTEL_ENABLED, FORGE_OTEL_ENDPOINT, FORGE_OTEL_SERVICE_NAME config
|
|
60
|
+
- New example: examples/otel_tracing.py
|
|
61
|
+
|
|
62
|
+
## [0.2.0] — 2026-06-28
|
|
63
|
+
|
|
64
|
+
### Added
|
|
65
|
+
- Parallel worker execution: the supervisor now runs workers concurrently with `asyncio.gather` in bounded batches (`max_workers`). A pre-flight budget cap refuses a batch before spawning if its worst-case spend would exceed the remaining budget, and a failing worker is isolated gracefully (emits `WORKER_FAILED`, returns a partial result) instead of cancelling its peers.
|
|
66
|
+
- Streaming token output through the event bus: `TOKEN_STREAM_START`, `TOKEN_CHUNK` (chunk plus running cumulative text), and `TOKEN_STREAM_END` events, enabled via `stream=True` on `Orchestrator.run()` and the `forge run --stream` CLI flag. `ModelProvider.stream()` ships a buffered default so every provider streams out of the box; `EchoProvider` streams natively offline.
|
|
67
|
+
- `WORKER_STARTED` and `WORKER_FAILED` lifecycle events (the event bus now exposes 21 event types, up from 16).
|
|
68
|
+
- Community health files: issue templates (bug report, feature request, provider request), a pull request template, and this changelog.
|
|
69
|
+
|
|
70
|
+
### Changed
|
|
71
|
+
- README rewritten to reflect the shipped feature set, including a "What's shipped" status table covering parallel execution, streaming, and all three providers.
|
|
72
|
+
- Test suite expanded to 47 hermetic tests (from 38); `mypy --strict` and `ruff` remain clean.
|
|
73
|
+
|
|
74
|
+
## [0.1.0] — 2026-06-28
|
|
75
|
+
|
|
76
|
+
### Added
|
|
77
|
+
- Multi-agent orchestration: a supervisor decomposes a goal into subtasks, delegates to focused worker agents (sequential execution), and synthesizes the result.
|
|
78
|
+
- Intelligent model routing: cost_optimized, quality_first, balanced, fixed strategies.
|
|
79
|
+
- Anthropic provider: Claude Haiku 4.5, Sonnet 4.6, Opus 4.8, Fable 5.
|
|
80
|
+
- OpenAI provider: gpt-4o-mini, gpt-4o, gpt-4.1, o3.
|
|
81
|
+
- Offline deterministic Echo provider (zero config, no API key required).
|
|
82
|
+
- Tool sandboxing with allowlist/denylist, per-tool timeouts, dangerous-denied-by-default.
|
|
83
|
+
- RBAC with roles: admin, operator, developer, viewer.
|
|
84
|
+
- Prompt-injection heuristics and input sanitization.
|
|
85
|
+
- SHA-256 hash-chained tamper-evident audit log.
|
|
86
|
+
- PII redaction: emails, cards, SSNs, IPs, phones.
|
|
87
|
+
- Event bus with 16 lifecycle event types.
|
|
88
|
+
- Per-run cost reporting (tokens + USD, per model, per agent).
|
|
89
|
+
- Conversation memory and in-memory RAG vector store.
|
|
90
|
+
- CLI: forge run, forge models, forge audit.
|
|
91
|
+
- 38 hermetic tests, mypy strict clean, ruff clean.
|
|
92
|
+
- CI matrix across Python 3.11, 3.12, 3.13.
|
|
93
|
+
- PyPI release via OIDC Trusted Publisher (pip install agentforge-oss).
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agentforge-oss
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2
|
|
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
|
|
7
7
|
Project-URL: Repository, https://github.com/sekacorn/AgentForge
|
|
8
8
|
Project-URL: Issues, https://github.com/sekacorn/AgentForge/issues
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
Project-URL: Changelog, https://github.com/sekacorn/AgentForge/blob/main/CHANGELOG.md
|
|
10
|
+
Author: sekacorn
|
|
11
|
+
Maintainer: sekacorn
|
|
11
12
|
License: MIT
|
|
12
13
|
License-File: LICENSE
|
|
13
14
|
Keywords: agents,ai,anthropic,claude,enterprise,governance,llm,multi-agent,observability,openai,orchestration,rag
|
|
@@ -44,11 +45,15 @@ Requires-Dist: anthropic>=0.20; extra == 'anthropic'
|
|
|
44
45
|
Provides-Extra: bedrock
|
|
45
46
|
Requires-Dist: boto3>=1.34; extra == 'bedrock'
|
|
46
47
|
Provides-Extra: dev
|
|
48
|
+
Requires-Dist: bandit>=1.7; extra == 'dev'
|
|
49
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
47
50
|
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
51
|
+
Requires-Dist: pip-audit>=2.7; extra == 'dev'
|
|
48
52
|
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
49
53
|
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
|
|
50
54
|
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
51
55
|
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
56
|
+
Requires-Dist: twine>=5.0; extra == 'dev'
|
|
52
57
|
Provides-Extra: docs
|
|
53
58
|
Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
|
|
54
59
|
Requires-Dist: mkdocs-minify-plugin>=0.8; extra == 'docs'
|
|
@@ -81,7 +86,7 @@ with cost-awareness, security, and compliance built in from line one.**
|
|
|
81
86
|
[](https://www.python.org/)
|
|
82
87
|
[](pyproject.toml)
|
|
83
88
|
[](https://sekacorn.github.io/AgentForge/)
|
|
84
|
-
[](#whats-shipped
|
|
89
|
+
[](#whats-currently-shipped)
|
|
85
90
|
|
|
86
91
|
</div>
|
|
87
92
|
|
|
@@ -124,7 +129,7 @@ asyncio.run(main())
|
|
|
124
129
|
|
|
125
130
|
---
|
|
126
131
|
|
|
127
|
-
## What's shipped
|
|
132
|
+
## What's currently shipped
|
|
128
133
|
|
|
129
134
|
An honest snapshot of what works today versus what is on the way. Everything marked
|
|
130
135
|
**Shipped** is implemented, typed, and covered by the test suite.
|
|
@@ -13,7 +13,7 @@ with cost-awareness, security, and compliance built in from line one.**
|
|
|
13
13
|
[](https://www.python.org/)
|
|
14
14
|
[](pyproject.toml)
|
|
15
15
|
[](https://sekacorn.github.io/AgentForge/)
|
|
16
|
-
[](#whats-shipped
|
|
16
|
+
[](#whats-currently-shipped)
|
|
17
17
|
|
|
18
18
|
</div>
|
|
19
19
|
|
|
@@ -56,7 +56,7 @@ asyncio.run(main())
|
|
|
56
56
|
|
|
57
57
|
---
|
|
58
58
|
|
|
59
|
-
## What's shipped
|
|
59
|
+
## What's currently shipped
|
|
60
60
|
|
|
61
61
|
An honest snapshot of what works today versus what is on the way. Everything marked
|
|
62
62
|
**Shipped** is implemented, typed, and covered by the test suite.
|
|
@@ -31,6 +31,7 @@ _ASYNCPG_MISSING = (
|
|
|
31
31
|
)
|
|
32
32
|
|
|
33
33
|
_TOKEN = re.compile(r"[a-z0-9]+")
|
|
34
|
+
_SQL_IDENTIFIER = re.compile(r"[A-Za-z_][A-Za-z0-9_]*\Z")
|
|
34
35
|
|
|
35
36
|
|
|
36
37
|
def _tokenize(text: str) -> list[str]:
|
|
@@ -42,12 +43,23 @@ def _stable_bucket(token: str, dim: int) -> int:
|
|
|
42
43
|
return int.from_bytes(digest, "big") % dim
|
|
43
44
|
|
|
44
45
|
|
|
46
|
+
def _quote_identifier(identifier: str) -> str:
|
|
47
|
+
if _SQL_IDENTIFIER.fullmatch(identifier) is None:
|
|
48
|
+
raise ValueError(
|
|
49
|
+
"PostgreSQL identifiers must start with a letter or underscore and "
|
|
50
|
+
"contain only letters, numbers, and underscores."
|
|
51
|
+
)
|
|
52
|
+
return f'"{identifier}"'
|
|
53
|
+
|
|
54
|
+
|
|
45
55
|
class PGVectorMemoryStore(Memory):
|
|
46
56
|
"""A durable cosine-similarity store backed by PostgreSQL + pgvector."""
|
|
47
57
|
|
|
48
58
|
def __init__(self, dsn: str, *, table: str = "forge_memories", embedding_dim: int = 64) -> None:
|
|
49
59
|
self._dsn = dsn
|
|
50
60
|
self._table = table
|
|
61
|
+
self._table_sql = _quote_identifier(table)
|
|
62
|
+
self._index_sql = _quote_identifier(f"{table}_embedding_idx")
|
|
51
63
|
self._dim = embedding_dim
|
|
52
64
|
self._pool: Any = None
|
|
53
65
|
|
|
@@ -75,8 +87,9 @@ class PGVectorMemoryStore(Memory):
|
|
|
75
87
|
async with self._pool.acquire() as conn:
|
|
76
88
|
await register_vector(conn)
|
|
77
89
|
await conn.execute("CREATE EXTENSION IF NOT EXISTS vector")
|
|
90
|
+
# SQL identifiers are validated and quoted before interpolation.
|
|
78
91
|
await conn.execute(
|
|
79
|
-
f"CREATE TABLE IF NOT EXISTS {self.
|
|
92
|
+
f"CREATE TABLE IF NOT EXISTS {self._table_sql} (" # nosec B608
|
|
80
93
|
f" id UUID PRIMARY KEY DEFAULT gen_random_uuid(),"
|
|
81
94
|
f" text TEXT NOT NULL,"
|
|
82
95
|
f" embedding vector({self._dim}),"
|
|
@@ -86,8 +99,8 @@ class PGVectorMemoryStore(Memory):
|
|
|
86
99
|
)
|
|
87
100
|
# lists=100 is appropriate for up to ~1M rows; tune for larger datasets
|
|
88
101
|
await conn.execute(
|
|
89
|
-
f"CREATE INDEX IF NOT EXISTS {self.
|
|
90
|
-
f"ON {self.
|
|
102
|
+
f"CREATE INDEX IF NOT EXISTS {self._index_sql} " # nosec B608
|
|
103
|
+
f"ON {self._table_sql} USING ivfflat (embedding vector_cosine_ops) "
|
|
91
104
|
f"WITH (lists = 100)"
|
|
92
105
|
)
|
|
93
106
|
return self
|
|
@@ -102,7 +115,7 @@ class PGVectorMemoryStore(Memory):
|
|
|
102
115
|
meta_json = json.dumps(metadata) if metadata is not None else None
|
|
103
116
|
async with self._pool.acquire() as conn:
|
|
104
117
|
row = await conn.fetchrow(
|
|
105
|
-
f"INSERT INTO {self.
|
|
118
|
+
f"INSERT INTO {self._table_sql} (text, embedding, metadata) " # nosec B608
|
|
106
119
|
f"VALUES ($1, $2, $3::jsonb) RETURNING id",
|
|
107
120
|
text,
|
|
108
121
|
embedding,
|
|
@@ -116,9 +129,9 @@ class PGVectorMemoryStore(Memory):
|
|
|
116
129
|
query_vector = self._embed(query)
|
|
117
130
|
async with self._pool.acquire() as conn:
|
|
118
131
|
rows = await conn.fetch(
|
|
119
|
-
f"SELECT id, text, metadata, "
|
|
132
|
+
f"SELECT id, text, metadata, " # nosec B608
|
|
120
133
|
f"1 - (embedding <=> $1::vector) AS similarity "
|
|
121
|
-
f"FROM {self.
|
|
134
|
+
f"FROM {self._table_sql} "
|
|
122
135
|
f"ORDER BY embedding <=> $1::vector "
|
|
123
136
|
f"LIMIT $2",
|
|
124
137
|
query_vector,
|
|
@@ -140,7 +153,7 @@ class PGVectorMemoryStore(Memory):
|
|
|
140
153
|
|
|
141
154
|
async def clear(self) -> None:
|
|
142
155
|
async with self._pool.acquire() as conn:
|
|
143
|
-
await conn.execute(f"DELETE FROM {self.
|
|
156
|
+
await conn.execute(f"DELETE FROM {self._table_sql}") # nosec B608
|
|
144
157
|
|
|
145
158
|
async def aclose(self) -> None:
|
|
146
159
|
"""Close the connection pool. Safe to call more than once."""
|
|
@@ -39,9 +39,10 @@ class EventType(enum.StrEnum):
|
|
|
39
39
|
MODEL_CALL_FINISHED = "model.call.finished"
|
|
40
40
|
MODEL_CALL_FAILED = "model.call.failed"
|
|
41
41
|
MODEL_ROUTED = "model.routed"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
# These are lifecycle event names, not credentials.
|
|
43
|
+
TOKEN_STREAM_START = "token.stream.start" # nosec B105
|
|
44
|
+
TOKEN_CHUNK = "token.chunk" # nosec B105
|
|
45
|
+
TOKEN_STREAM_END = "token.stream.end" # nosec B105
|
|
45
46
|
TOOL_CALL_STARTED = "tool.call.started"
|
|
46
47
|
TOOL_CALL_FINISHED = "tool.call.finished"
|
|
47
48
|
TOOL_CALL_FAILED = "tool.call.failed"
|
|
@@ -21,7 +21,15 @@ _MAX_BYTES = 20_000
|
|
|
21
21
|
#: does not defeat DNS rebinding, alternate IP encodings, or other private ranges —
|
|
22
22
|
#: operators allowlisting this tool should still enforce network egress controls.
|
|
23
23
|
_BLOCKED_HOSTS = frozenset(
|
|
24
|
-
{
|
|
24
|
+
{
|
|
25
|
+
"localhost",
|
|
26
|
+
"127.0.0.1",
|
|
27
|
+
# Blocked host literal, not a bind address.
|
|
28
|
+
"0.0.0.0", # nosec B104
|
|
29
|
+
"::1",
|
|
30
|
+
"169.254.169.254",
|
|
31
|
+
"metadata.google.internal",
|
|
32
|
+
}
|
|
25
33
|
)
|
|
26
34
|
|
|
27
35
|
|
|
@@ -7,13 +7,13 @@ build-backend = "hatchling.build"
|
|
|
7
7
|
|
|
8
8
|
[project]
|
|
9
9
|
name = "agentforge-oss"
|
|
10
|
-
|
|
10
|
+
dynamic = ["version"]
|
|
11
11
|
description = "Forge — an open-source, enterprise-ready multi-agent orchestration platform with cost awareness, governance, and security built in."
|
|
12
12
|
readme = "README.md"
|
|
13
13
|
requires-python = ">=3.11"
|
|
14
14
|
license = { text = "MIT" }
|
|
15
|
-
authors = [{ name = "
|
|
16
|
-
maintainers = [{ name = "
|
|
15
|
+
authors = [{ name = "sekacorn" }]
|
|
16
|
+
maintainers = [{ name = "sekacorn" }]
|
|
17
17
|
keywords = [
|
|
18
18
|
"agents",
|
|
19
19
|
"multi-agent",
|
|
@@ -82,11 +82,15 @@ docs = [
|
|
|
82
82
|
"mkdocs-minify-plugin>=0.8",
|
|
83
83
|
]
|
|
84
84
|
dev = [
|
|
85
|
+
"bandit>=1.7",
|
|
86
|
+
"build>=1.2",
|
|
87
|
+
"pip-audit>=2.7",
|
|
85
88
|
"pytest>=8.0",
|
|
86
89
|
"pytest-asyncio>=0.23",
|
|
87
90
|
"pytest-cov>=5.0",
|
|
88
91
|
"mypy>=1.10",
|
|
89
92
|
"ruff>=0.6",
|
|
93
|
+
"twine>=5.0",
|
|
90
94
|
]
|
|
91
95
|
|
|
92
96
|
[project.scripts]
|
|
@@ -97,12 +101,16 @@ Homepage = "https://github.com/sekacorn/AgentForge"
|
|
|
97
101
|
Documentation = "https://github.com/sekacorn/AgentForge#readme"
|
|
98
102
|
Repository = "https://github.com/sekacorn/AgentForge"
|
|
99
103
|
Issues = "https://github.com/sekacorn/AgentForge/issues"
|
|
104
|
+
Changelog = "https://github.com/sekacorn/AgentForge/blob/main/CHANGELOG.md"
|
|
105
|
+
|
|
106
|
+
[tool.hatch.version]
|
|
107
|
+
path = "forge/_version.py"
|
|
100
108
|
|
|
101
109
|
[tool.hatch.build.targets.wheel]
|
|
102
110
|
packages = ["forge"]
|
|
103
111
|
|
|
104
112
|
[tool.hatch.build.targets.sdist]
|
|
105
|
-
include = ["forge", "README.md", "LICENSE", "examples", "tests"]
|
|
113
|
+
include = ["forge", "README.md", "CHANGELOG.md", "LICENSE", "examples", "tests"]
|
|
106
114
|
|
|
107
115
|
# ---------------------------------------------------------------------------
|
|
108
116
|
# Ruff — linting & formatting
|
|
@@ -177,6 +177,11 @@ async def test_custom_table_and_dim() -> None:
|
|
|
177
177
|
assert len(vec) == 128
|
|
178
178
|
|
|
179
179
|
|
|
180
|
+
def test_invalid_table_name_is_rejected() -> None:
|
|
181
|
+
with pytest.raises(ValueError, match="PostgreSQL identifiers"):
|
|
182
|
+
PGVectorMemoryStore("postgresql://test", table="bad; DROP TABLE memories")
|
|
183
|
+
|
|
184
|
+
|
|
180
185
|
def test_import_error_message() -> None:
|
|
181
186
|
from forge.memory.pgvector import _ASYNCPG_MISSING
|
|
182
187
|
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|