framework-agents 0.1.0__py3-none-any.whl
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.
- framework_agents/__init__.py +345 -0
- framework_agents/a2a_client.py +360 -0
- framework_agents/a2a_server.py +495 -0
- framework_agents/agent.py +920 -0
- framework_agents/checkpoint.py +231 -0
- framework_agents/config.py +200 -0
- framework_agents/conversation.py +249 -0
- framework_agents/errors.py +47 -0
- framework_agents/evals.py +127 -0
- framework_agents/mcp_client.py +477 -0
- framework_agents/memory.py +103 -0
- framework_agents/memory_compaction.py +63 -0
- framework_agents/middleware.py +1302 -0
- framework_agents/models/__init__.py +100 -0
- framework_agents/models/anthropic.py +339 -0
- framework_agents/models/capabilities.py +45 -0
- framework_agents/models/ollama.py +47 -0
- framework_agents/models/openai_compatible.py +409 -0
- framework_agents/observability.py +84 -0
- framework_agents/ontology_review.py +321 -0
- framework_agents/orchestration.py +169 -0
- framework_agents/pricing.py +63 -0
- framework_agents/prompts.py +132 -0
- framework_agents/rag.py +123 -0
- framework_agents/remote_sparql.py +213 -0
- framework_agents/runtime.py +88 -0
- framework_agents/sandbox.py +327 -0
- framework_agents/semantic.py +1614 -0
- framework_agents/serve.py +436 -0
- framework_agents/sessions.py +249 -0
- framework_agents/skills.py +213 -0
- framework_agents/state.py +89 -0
- framework_agents/streaming.py +74 -0
- framework_agents/swarm.py +318 -0
- framework_agents/tools.py +114 -0
- framework_agents/tracing.py +131 -0
- framework_agents/types.py +262 -0
- framework_agents/workflows.py +130 -0
- framework_agents-0.1.0.dist-info/METADATA +118 -0
- framework_agents-0.1.0.dist-info/RECORD +41 -0
- framework_agents-0.1.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: framework-agents
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python agent framework: ReAct loop, tools, memory, streaming, budgets, middleware, multi-agent, semantic graph, A2A serving - parity with the TypeScript package
|
|
5
|
+
Project-URL: Homepage, https://github.com/fab679/framework
|
|
6
|
+
Project-URL: Documentation, https://fab679.github.io/framework/
|
|
7
|
+
Project-URL: Repository, https://github.com/fab679/framework
|
|
8
|
+
Project-URL: Changelog, https://github.com/fab679/framework/releases
|
|
9
|
+
Author: Framework Agents
|
|
10
|
+
License: MIT
|
|
11
|
+
Keywords: a2a,agents,ai,asyncio,llm,mcp,semantic-web,streaming
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Framework :: AsyncIO
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Requires-Dist: httpx>=0.27
|
|
25
|
+
Requires-Dist: pydantic>=2.7
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: anyio>=4; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# Python package — TS parity port (`framework_agents`)
|
|
33
|
+
|
|
34
|
+
The TypeScript package (`packages/typescript`) is the reference implementation.
|
|
35
|
+
This port targets API parity with the **fixed** TS semantics — every behavior
|
|
36
|
+
that was a real bug during the TS line (and is regression-pinned there) is
|
|
37
|
+
encoded here from day one:
|
|
38
|
+
|
|
39
|
+
| Pinned semantic | Why |
|
|
40
|
+
|---|---|
|
|
41
|
+
| `reasoning_tokens` is a SUBSET of `output_tokens` | never double-billed in budgets/cost |
|
|
42
|
+
| `cost_usd` only when a price is known | unknown models → `None`, never a fake $0 |
|
|
43
|
+
| `save()` APPENDS; the loop does clear-then-save | history never duplicates across runs |
|
|
44
|
+
| Structured `'auto'` resolves by capability | unresolved auto never throws STRUCTURED_NO_MATCH |
|
|
45
|
+
| `finish_reason=length` + zero content → loud `MODEL_ERROR` | a thinking model burning its whole budget is not a silent empty answer |
|
|
46
|
+
| Tool parameter schemas ride the wire | models see real argument shapes |
|
|
47
|
+
| HITL decisions: exact key THEN bare tool name | resume converges even when models regenerate arg text |
|
|
48
|
+
| Local `ollama:` pricing wins over name collisions | never bill cloud prices for free local models |
|
|
49
|
+
| Storage keys/threadIds reject traversal (`..`) | no writes outside the root |
|
|
50
|
+
| Remote SPARQL: descriptive UA + 429/5xx retry honoring Retry-After | public endpoints reject and rate-limit otherwise |
|
|
51
|
+
|
|
52
|
+
No personal or brand names appear anywhere in this package.
|
|
53
|
+
|
|
54
|
+
## Port status (mirroring the TS module map)
|
|
55
|
+
|
|
56
|
+
| TS module | Python | State |
|
|
57
|
+
|---|---|---|
|
|
58
|
+
| types (messages/blocks/usage) | `types.py` | ✅ |
|
|
59
|
+
| errors + retryable verdicts | `errors.py` | ✅ |
|
|
60
|
+
| tools (define_tool/registry/schemas) | `tools.py` | ✅ |
|
|
61
|
+
| memory (+compaction) | `memory.py`, `memory_compaction.py` | ✅ (MEMORY_CORRUPT loud, atomic unique-tmp writes) |
|
|
62
|
+
| conversation managers | `conversation.py` | ✅ (order-preserving pin; model or fn summarizer) |
|
|
63
|
+
| sessions + snapshots | `sessions.py` | ✅ (validated keys, TS-tested preset semantics) |
|
|
64
|
+
| checkpoint + file locks | `checkpoint.py` | ✅ (O_EXCL + stale reclaim, threadId validation) |
|
|
65
|
+
| runtime (abort/timeout) | `runtime.py` | ✅ |
|
|
66
|
+
| models (mock + OpenAI-compatible + Anthropic + Ollama) | `models/` | ✅ (Together+OpenAI field unions, native Anthropic Messages API w/ thinking budgets + SSE machine, vision capability fail-fast, stream usage, truncation guard) |
|
|
67
|
+
| state (AgentState + invocation) | `state.py`, `agent.py` | ✅ (validated JSON KV, custom-prototype rejection, snapshots/session restore, pause/resume, edit/branch/timelines, v1 reasoning blocks, `with_tools`) |
|
|
68
|
+
| pricing | `pricing.py` | ✅ |
|
|
69
|
+
| config + factory | `config.py` | ✅ (together/openai/ollama/custom) |
|
|
70
|
+
| agent loop (budgets/structured/streaming) | `agent.py` | ✅ (calls stream via drain; budget price refusal; synthesized final answer) |
|
|
71
|
+
| middleware (hooks, HITL, retries, limits, policy, todos, pii) | `middleware.py` | ✅ |
|
|
72
|
+
| orchestration | `orchestration.py` | ✅ (sequential/parallel/router; routed result semantics) |
|
|
73
|
+
| workflows | `workflows.py` | ✅ (dedup'd indegree, retries, propagation) |
|
|
74
|
+
| swarm | `swarm.py` | ✅ (handoff tool + stream events + loop detection default) |
|
|
75
|
+
| evals | `evals.py` | ✅ (JSONL + pass-rate reporter) |
|
|
76
|
+
| skills + TF-IDF routing | `skills.py` | ✅ ($mention word-boundary wins) |
|
|
77
|
+
| prompts (+A/B) | `prompts.py` | ✅ (CRLF/BOM tolerance) |
|
|
78
|
+
| rag (tf-idf retriever + tool) | `rag.py` | ✅ |
|
|
79
|
+
| semantic (store/SHACL/rules/graph memory/linking/JSON-LD/evolution) | `semantic.py`, `ontology_review.py` | ✅ (version graphs under `urn:framework:ontology:*`) |
|
|
80
|
+
| remote SPARQL | `remote_sparql.py` | ✅ (UA + Retry-After retry) |
|
|
81
|
+
| A2A clients (SSE + JSON-RPC) | `a2a_client.py` | ✅ (envelope + contextId chain + retry) |
|
|
82
|
+
| A2A server (contexts/LRU/disconnect/SSE) | `a2a_server.py` | ✅ (stdio-of-asyncio raw HTTP, body caps, CORS) |
|
|
83
|
+
| MCP clients + bridging | `mcp_client.py` | ✅ (stdio child lifecycle, no-id notification, per-tool degrade) |
|
|
84
|
+
| observability + tracing sinks | `observability.py`, `tracing.py` | ✅ |
|
|
85
|
+
| sandbox (JS + shell) | `sandbox.py` | ✅ (caveat: exec timeouts abandon a thread, no hard kill) |
|
|
86
|
+
| serve (framework.json + CLI) | `serve.py` | ✅ (lazy model init, argparse CLI, per-context isolated agents) |
|
|
87
|
+
| React SDK | — | n/a (React-specific; browser clients use A2A/SSE) |
|
|
88
|
+
|
|
89
|
+
**Batch-2 middleware** (`model_fallback`, `summarization`, `context_editing` +
|
|
90
|
+
`ClearToolUsesEdit`, `llm_tool_selector`, `tool_emulator`, `filesystem`,
|
|
91
|
+
`create_sub_agent`, `pii` tool-results) is ported with deviations pinned in
|
|
92
|
+
`middleware.py`'s docstring (feedback-strings instead of raises on escape
|
|
93
|
+
misses; `older_than_steps` interpreted as a step gate).
|
|
94
|
+
|
|
95
|
+
## Running
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
python3 -m venv .venv
|
|
99
|
+
.venv/bin/pip install -e ".[dev]"
|
|
100
|
+
.venv/bin/python -m pytest tests -q # offline parity suite (233 tests)
|
|
101
|
+
E2E_MODEL=1 .venv/bin/python -m pytest tests -q -m live
|
|
102
|
+
# live Together parity runs; OpenAI + Anthropic suites skip cleanly and go
|
|
103
|
+
# live as soon as OPENAI_API_KEY / ANTHROPIC_API_KEY appear in framework/.env
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Known deviations (documented in module docstrings)
|
|
107
|
+
|
|
108
|
+
- `Agent.stream()` yields a `done` event and stores the result (generators
|
|
109
|
+
can't return values); run() drains — wire contracts identical.
|
|
110
|
+
- Async file IO runs via `asyncio.to_thread` in filesystem tools; storage
|
|
111
|
+
classes use blocking IO inside async methods (single-process locality).
|
|
112
|
+
- Sandbox JS cannot hard-interrupt a thread mid-statement (node:vm can) —
|
|
113
|
+
the timeout surfaces per contract, the abandoned thread dies at exit.
|
|
114
|
+
- Semantic version graphs use `urn:framework:ontology:<version>` (the TS
|
|
115
|
+
default `urn:fabisch:*` embeds a personal name; both are configurable).
|
|
116
|
+
- Cross-language conformance: the Python A2A client speaks the exact wire
|
|
117
|
+
contract of the TS A2A server (envelope, SSE frames, [DONE]) and vice
|
|
118
|
+
versa — see `tests/test_servers_and_clients.py`.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
framework_agents/__init__.py,sha256=qnmBtJD0hYGkndKD-PoinUBgn6GoqxRrJNzD7wsa9W4,8480
|
|
2
|
+
framework_agents/a2a_client.py,sha256=G-ZkjP1cUEmZbE6i3Fm3t8btYT-9a_xVtY4oybX-fa0,14681
|
|
3
|
+
framework_agents/a2a_server.py,sha256=7alOMcJIOOhsFB1y2HZYgINom5iWZN_qzANwVIcQuJg,22531
|
|
4
|
+
framework_agents/agent.py,sha256=KDH4ekh2J7Clb0buZ4U_y5hQbuk8b3BRPP1Yrvns5_g,41849
|
|
5
|
+
framework_agents/checkpoint.py,sha256=5uLl-IIoKXWYZuqvssQA3UjZMP_lIqrQoONQe3X-SyQ,8626
|
|
6
|
+
framework_agents/config.py,sha256=VkMUtgefhcyMfitCu22j--pmyUVXWAlgTAcGdTbadpM,7368
|
|
7
|
+
framework_agents/conversation.py,sha256=JAdIeZxY8t8eFaew_DA7Lzzg3XqOG9VcjAoDb3UbHI4,8811
|
|
8
|
+
framework_agents/errors.py,sha256=2Zo1XAhLoUF5SKh0Z2TEs4QfDqov-5yzOpJOi7FoX8E,1521
|
|
9
|
+
framework_agents/evals.py,sha256=1ozPwKbqIYIFsadK4Z_tFdoAY15sEbVwsNSGXKxJUR4,3757
|
|
10
|
+
framework_agents/mcp_client.py,sha256=PG7ao7v4TBZABTCFBR2wr3STW80XZW49ig0GAMEMeMA,19522
|
|
11
|
+
framework_agents/memory.py,sha256=DFed_meLWKaboUIhzMhPWjcD4mzIR-tscuexxZwXpsE,3962
|
|
12
|
+
framework_agents/memory_compaction.py,sha256=JbOdKy2VQtnSyMP1Wfz8wj0cgm91Ix6_8hvaHkzIlj4,2036
|
|
13
|
+
framework_agents/middleware.py,sha256=QFBcLqRkKtV0NI_ZWLyEBlum5tIVU7UESO5csNqezdI,53431
|
|
14
|
+
framework_agents/observability.py,sha256=hRUrf6S9gJfydf-8jdAUCkL_EuxszM9C2O4oxsccIKw,2963
|
|
15
|
+
framework_agents/ontology_review.py,sha256=Q31RF51xxM6kLXOIylYsQzBS0JdiIOJky_KNzyq9dcs,12412
|
|
16
|
+
framework_agents/orchestration.py,sha256=z24uhanparRVSiL4JOM9aTD2WgRQV-zSKhvWWo0pyQ8,6552
|
|
17
|
+
framework_agents/pricing.py,sha256=XHdoavy2tqZk8eWVfUGTlmypwJMvJ86NJQV2lc1LQaI,2438
|
|
18
|
+
framework_agents/prompts.py,sha256=aJqx9JwBRag2v_lcmv1aPP_qRoGs0ngEhFqC7mxbqCQ,4544
|
|
19
|
+
framework_agents/rag.py,sha256=rS3WF3jNQhOtFcjl7bCy9jOaylhU_nDvNguNeAJ24fs,4239
|
|
20
|
+
framework_agents/remote_sparql.py,sha256=BG3o02uWqwiMUc9jkNeVCrKyvnbAPom5YTN3WB-ANiU,8760
|
|
21
|
+
framework_agents/runtime.py,sha256=XeZ3mph1qXO_zKvuZ5Nuv5wBR4goLFEPiHCSFUgkxj8,3212
|
|
22
|
+
framework_agents/sandbox.py,sha256=gCasWJJCGk6R3QOj_S-s9caOI8Hy7x5UNYJSzhq8TUs,11794
|
|
23
|
+
framework_agents/semantic.py,sha256=8VM6bfy7IoTHAcZYNwXxYqCmw8z-jCofFZXqX3oy-3o,62345
|
|
24
|
+
framework_agents/serve.py,sha256=XEKNRajr6h6TFMdqHPoFDs4q85qlPX0rcASYba9fylQ,17231
|
|
25
|
+
framework_agents/sessions.py,sha256=aJNNjLGKYQEoNZMHBK2pVHpiiAtOullDZi4HU77Z6MI,8422
|
|
26
|
+
framework_agents/skills.py,sha256=4OU1Ti6NN17hiyjm8L8jrKBm1LX2qyT32wfHEx79mcs,6812
|
|
27
|
+
framework_agents/state.py,sha256=vtpdMjeSY_Sgdm0b9dnIQoXjivvHlYY9-Y2pKIcQHSU,3709
|
|
28
|
+
framework_agents/streaming.py,sha256=yzeeN3Z0LsGl-w1VKJmE3z7uEO9FoDJzPNICXFsU23A,2647
|
|
29
|
+
framework_agents/swarm.py,sha256=V_HA6uUUks8sv2vEp3MAHJ4i-vTCnzzW-PIjTpI_H2k,13382
|
|
30
|
+
framework_agents/tools.py,sha256=5hQLg1AHOtpRkrJBK68rmvHJbPPwOUDtK8tLkduPbdE,3748
|
|
31
|
+
framework_agents/tracing.py,sha256=lkx1BjhZuIybWBdU-HxhwCrTVvEhtsHn6XA6n8wmb7w,4790
|
|
32
|
+
framework_agents/types.py,sha256=44vtfoNJVZbeIk5BglvfVnJriAY7tK-o7A_81cHx-nk,8798
|
|
33
|
+
framework_agents/workflows.py,sha256=mNLiohL3u6nRS0jwWIYfze_-GkRyOtG7IJWGApQvcDw,4430
|
|
34
|
+
framework_agents/models/__init__.py,sha256=XOXdD3i5iDS4pS90rZBQ0rK8iR98e8IgOMz7WY7aQhQ,2757
|
|
35
|
+
framework_agents/models/anthropic.py,sha256=XXHekpEl_qY2zixkFo6b2DcfxGJwJM7TNcnmL-2eQf0,15256
|
|
36
|
+
framework_agents/models/capabilities.py,sha256=GS7Rxns9twQWJLJG3WEj4wNtueTdWZcwoHQe25Oa82M,1428
|
|
37
|
+
framework_agents/models/ollama.py,sha256=QMRAtLt0weQG-MnEhe6w7w63X4P2ijAzmy6Sci5_0DY,1570
|
|
38
|
+
framework_agents/models/openai_compatible.py,sha256=tOj5dSlGgFwdczsOqIDe1jv6P1QyxByh8mE7ZJRHQ2k,17816
|
|
39
|
+
framework_agents-0.1.0.dist-info/METADATA,sha256=dTLgPgi5bgjN2wcc88WMMKG_PF_NNP4nsdPl5LQSfzY,7282
|
|
40
|
+
framework_agents-0.1.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
41
|
+
framework_agents-0.1.0.dist-info/RECORD,,
|