praxo-core 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.
Files changed (49) hide show
  1. praxo_core-0.2.1/API.md +135 -0
  2. praxo_core-0.2.1/LICENSE +21 -0
  3. praxo_core-0.2.1/MANIFEST.in +6 -0
  4. praxo_core-0.2.1/PKG-INFO +135 -0
  5. praxo_core-0.2.1/README.md +117 -0
  6. praxo_core-0.2.1/api/0.1.0.txt +295 -0
  7. praxo_core-0.2.1/api/0.2.0.signatures.txt +1472 -0
  8. praxo_core-0.2.1/api/0.2.0.txt +296 -0
  9. praxo_core-0.2.1/api/0.2.1.signatures.txt +1472 -0
  10. praxo_core-0.2.1/api/0.2.1.txt +296 -0
  11. praxo_core-0.2.1/conformance/run.py +27 -0
  12. praxo_core-0.2.1/praxo/__init__.py +104 -0
  13. praxo_core-0.2.1/praxo/adapters/__init__.py +3 -0
  14. praxo_core-0.2.1/praxo/adapters/openaicompat.py +231 -0
  15. praxo_core-0.2.1/praxo/agent.py +371 -0
  16. praxo_core-0.2.1/praxo/checkpoint.py +141 -0
  17. praxo_core-0.2.1/praxo/conformance.py +549 -0
  18. praxo_core-0.2.1/praxo/conformance_agent.py +118 -0
  19. praxo_core-0.2.1/praxo/context.py +258 -0
  20. praxo_core-0.2.1/praxo/errors.py +105 -0
  21. praxo_core-0.2.1/praxo/event.py +81 -0
  22. praxo_core-0.2.1/praxo/jsonschema.py +171 -0
  23. praxo_core-0.2.1/praxo/memory.py +111 -0
  24. praxo_core-0.2.1/praxo/middleware/__init__.py +61 -0
  25. praxo_core-0.2.1/praxo/middleware/base.py +101 -0
  26. praxo_core-0.2.1/praxo/middleware/calllimit.py +55 -0
  27. praxo_core-0.2.1/praxo/middleware/fallback.py +22 -0
  28. praxo_core-0.2.1/praxo/middleware/pii.py +86 -0
  29. praxo_core-0.2.1/praxo/middleware/structured.py +136 -0
  30. praxo_core-0.2.1/praxo/middleware/toolselect.py +129 -0
  31. praxo_core-0.2.1/praxo/model.py +235 -0
  32. praxo_core-0.2.1/praxo/parity.py +44 -0
  33. praxo_core-0.2.1/praxo/plugin.py +327 -0
  34. praxo_core-0.2.1/praxo/policy.py +118 -0
  35. praxo_core-0.2.1/praxo/stream.py +33 -0
  36. praxo_core-0.2.1/praxo/tool.py +92 -0
  37. praxo_core-0.2.1/praxo/toolcall.py +246 -0
  38. praxo_core-0.2.1/praxo_core.egg-info/PKG-INFO +135 -0
  39. praxo_core-0.2.1/praxo_core.egg-info/SOURCES.txt +47 -0
  40. praxo_core-0.2.1/praxo_core.egg-info/dependency_links.txt +1 -0
  41. praxo_core-0.2.1/praxo_core.egg-info/top_level.txt +1 -0
  42. praxo_core-0.2.1/pyproject.toml +28 -0
  43. praxo_core-0.2.1/setup.cfg +4 -0
  44. praxo_core-0.2.1/tests/installed_smoke.py +35 -0
  45. praxo_core-0.2.1/tests/test_api_signatures.py +76 -0
  46. praxo_core-0.2.1/tests/test_conformance.py +65 -0
  47. praxo_core-0.2.1/tests/test_context.py +125 -0
  48. praxo_core-0.2.1/tests/test_middleware.py +252 -0
  49. praxo_core-0.2.1/tests/test_openaicompat.py +158 -0
@@ -0,0 +1,135 @@
1
+ # Python API Reference
2
+
3
+ Normative contract: [`spec/`](../../spec/README.md). This page lists the public
4
+ Python surface. The checked-in snapshot is `api/<version>.txt`.
5
+
6
+ ## `praxo.model`
7
+
8
+ | Symbol | Purpose |
9
+ | --- | --- |
10
+ | `Model` | Async `generate(request) -> Response` protocol |
11
+ | `StreamingModel` | Adds `generate_stream(request, on_delta)` |
12
+ | `Provider` | Chat-oriented `chat` / `chat_stream` contract |
13
+ | `ChatModel` | Adapts a `Provider` to `Model` |
14
+ | `Message`, `ContentBlock`, `ToolCall`, `ToolSpec` | Wire-compatible model types |
15
+ | `Request`, `Response`, `Usage` | Request/response envelopes |
16
+ | `ResponseFormat`, `CacheHint` | Provider-neutral structured output and cache hints |
17
+
18
+ ## `praxo.tool`
19
+
20
+ | Symbol | Purpose |
21
+ | --- | --- |
22
+ | `Tool` | `name`, `description`, async `invoke(args)` |
23
+ | `FuncTool` | Function-backed tool |
24
+ | `Registry` | Name-indexed tool registry with sorted specs |
25
+ | `Gateway`, `GatewayInfo`, `GatewayTool` | External tool gateway seam |
26
+
27
+ ## `praxo.event`
28
+
29
+ | Symbol | Purpose |
30
+ | --- | --- |
31
+ | `Event` | Lifecycle event envelope |
32
+ | `Sink` | Async `emit(event)` |
33
+ | `MultiSink` | Fail-fast fan-out |
34
+ | `FilterSink` | Predicate-filtered forwarding |
35
+
36
+ ## `praxo.policy`
37
+
38
+ | Symbol | Purpose |
39
+ | --- | --- |
40
+ | `Hook`, `FuncHook` | Async authorization hook |
41
+ | `Action`, `Decision` | Authorization input/output |
42
+ | `PathGrant`, `PathChecker` | Deny-by-default filesystem containment |
43
+
44
+ ## `praxo.memory`
45
+
46
+ | Symbol | Purpose |
47
+ | --- | --- |
48
+ | `Store` | Async `put` / `search` contract |
49
+ | `Record`, `Frame` | Typed memory record |
50
+ | `MemoryStore` | In-memory store, newest-first search |
51
+ | `ContextAssembler` | Query-relevant memory retrieval |
52
+
53
+ ## `praxo.checkpoint`
54
+
55
+ | Symbol | Purpose |
56
+ | --- | --- |
57
+ | `Checkpoint`, `Message`, `RunSnapshot`, `EffectCursor` | Durable snapshot types |
58
+ | `Store` | Async checkpoint store contract |
59
+ | `Allowlist` | Typed envelope marshal/unmarshal allowlist |
60
+
61
+ ## `praxo.context`
62
+
63
+ | Symbol | Purpose |
64
+ | --- | --- |
65
+ | `ContextBudget` | Deterministic prompt compaction |
66
+ | `estimate_tokens` | Provider-neutral token estimate |
67
+ | `ContextCompactor`, `ModelSummarizer` | Optional summarization pass |
68
+ | `Offloader`, `OffloadFunc` | Large tool-result offload seam |
69
+ | `load_agents_md` | Bounded `AGENTS.md` loading |
70
+ | `MaxAgentsMDBytes` | Combined AGENTS.md limit |
71
+
72
+ ## `praxo.middleware`
73
+
74
+ | Symbol | Purpose |
75
+ | --- | --- |
76
+ | `Middleware`, `ModelCall`, `ToolCall`, `ToolResult`, `RunState` | Middleware contracts |
77
+ | `call_limit_middleware` | Per-run model/tool call budgets |
78
+ | `fallback_model` | Fallback model middleware |
79
+ | `PIIRedactor`, `PIIRule`, `default_pii_rules`, `pii_middleware` | PII redaction |
80
+ | `StructuredOutput` | JSON schema binding, validation, repair |
81
+ | `ToolSelector`, `ModelToolSelector`, `tool_selection_middleware` | Per-run tool narrowing |
82
+
83
+ ## `praxo.agent`
84
+
85
+ | Symbol | Purpose |
86
+ | --- | --- |
87
+ | `Agent` | Governed async agent loop |
88
+ | `AgentOptions` | Model, tools, events, policy, context, middleware, limits |
89
+ | `Session`, `Result` | Run scope and outcome |
90
+
91
+ ## `praxo.toolcall`
92
+
93
+ | Symbol | Purpose |
94
+ | --- | --- |
95
+ | `parse_tool_call` | Parse supported model tool-call formats |
96
+ | `strip_tool_call_markup` | Remove recognized tool-call markup |
97
+ | `parse_input_json` | Tolerant JSON object parsing |
98
+
99
+ ## `praxo.jsonschema`
100
+
101
+ | Symbol | Purpose |
102
+ | --- | --- |
103
+ | `Schema`, `ValidationError` | Documented JSON Schema subset |
104
+ | `from_json`, `validate` | Parse and validate helpers |
105
+
106
+ ## `praxo.plugin`
107
+
108
+ | Symbol | Purpose |
109
+ | --- | --- |
110
+ | `parse_manifest` | Strict Manifest v1 parse and validation |
111
+ | `validate_trust` | Signed/unsigned trust profile |
112
+ | `KINDS`, `STATES`, `EVENT_KINDS`, `CALL_ERROR_CODES` | Frozen enums |
113
+
114
+ ## `praxo.adapters.openaicompat`
115
+
116
+ | Symbol | Purpose |
117
+ | --- | --- |
118
+ | `OpenAIConfig` | Base URL, key, model, timeout, headers |
119
+ | `OpenAICompatibleModel` | Non-streaming and SSE streaming adapter |
120
+
121
+ ## Snapshot
122
+
123
+ ```bash
124
+ python api-snapshot.py
125
+ python api-snapshot.py --check
126
+ python api-signatures.py
127
+ python api-signatures.py --check
128
+ ```
129
+
130
+ `api/<version>.txt` records exported names and top-level function signatures.
131
+ `api/<version>.signatures.txt` adds class constructors, dataclass fields and
132
+ defaults, methods, properties, functions, and exported constants. The signature
133
+ snapshot was added after `0.2.0`; it does not rewrite the historical name
134
+ snapshot or imply that the released package already contained this gate. It is a
135
+ source-API check, not a runtime, serializer, or ABI guarantee.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AxisVela
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,6 @@
1
+ include LICENSE
2
+ include README.md
3
+ include API.md
4
+ recursive-include api *.txt
5
+ recursive-include conformance *.py
6
+ recursive-include tests *.py
@@ -0,0 +1,135 @@
1
+ Metadata-Version: 2.4
2
+ Name: praxo-core
3
+ Version: 0.2.1
4
+ Summary: Python SDK for the PRAXO-CORE agent contract
5
+ Author: AxisVela
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/axisvela/praxo-core
8
+ Project-URL: Documentation, https://axisvela.github.io/praxo-core/languages/python/
9
+ Project-URL: Source, https://github.com/axisvela/praxo-core/tree/main/language/python
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
14
+ Requires-Python: >=3.11
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Dynamic: license-file
18
+
19
+ # PRAXO-CORE Python SDK
20
+
21
+ Python implementation of the PRAXO-CORE contract. The normative contract is
22
+ [`spec/`](../../spec/README.md); Go remains the reference implementation.
23
+
24
+ **Status:** Core plus streaming, context management, middleware, and an
25
+ OpenAI-compatible adapter. The package passes all eleven conformance vector
26
+ groups.
27
+ VFS and plugin hosts are not yet implemented. Wheel and sdist builds are
28
+ verified; PyPI publication is pending. Use the source installation below.
29
+
30
+ Package version: `0.2.1` source candidate; the latest released source tag is
31
+ `python/v0.2.0`. Supported contract: `SPEC_VERSION` `0.2.0`
32
+ (`praxo.SPEC_VERSION`).
33
+
34
+ ## Requirements
35
+
36
+ - Python 3.11 or newer
37
+ - No runtime dependencies
38
+
39
+ ## Install
40
+
41
+ ```bash
42
+ pip install ./language/python
43
+ ```
44
+
45
+ ## Usage
46
+
47
+ ```python
48
+ import asyncio
49
+
50
+ from praxo.agent import Agent, AgentOptions, Session
51
+ from praxo.event import Event
52
+ from praxo.model import Message, Response, Usage
53
+ from praxo.tool import FuncTool, Registry
54
+
55
+
56
+ class EchoModel:
57
+ async def generate(self, request):
58
+ return Response(message=Message(role="assistant", content="hello"))
59
+
60
+
61
+ class LogSink:
62
+ async def emit(self, event: Event) -> None:
63
+ print(event.to_wire())
64
+
65
+
66
+ async def main() -> None:
67
+ tools = Registry()
68
+ tools.register(FuncTool("echo", "Echo input", lambda args: args))
69
+ agent = Agent(
70
+ AgentOptions(model=EchoModel(), tools=tools, events=LogSink())
71
+ )
72
+ result = await agent.run(Session(id="session-1"), "hi")
73
+ print(result.output, result.steps, result.usage)
74
+
75
+
76
+ asyncio.run(main())
77
+ ```
78
+
79
+ ## Contract Surface
80
+
81
+ | Module | Contract |
82
+ | --- | --- |
83
+ | `praxo.model` | `Model`, `Request`, `Response`, messages, tool specs, usage |
84
+ | `praxo.tool` | `Tool`, `Registry`, `FuncTool` |
85
+ | `praxo.event` | `Event`, `Sink`, `MultiSink`, `FilterSink` |
86
+ | `praxo.policy` | `Hook`, `Action`, `Decision`, `PathChecker` |
87
+ | `praxo.memory` | `Store`, `Record`, `MemoryStore`, `ContextAssembler` |
88
+ | `praxo.checkpoint` | `Checkpoint`, `Allowlist` |
89
+ | `praxo.agent` | `Agent`, `AgentOptions`, `Session`, `Result` |
90
+ | `praxo.context` | `ContextBudget`, `ModelSummarizer`, `Offloader`, `load_agents_md` |
91
+ | `praxo.middleware` | call limits, fallback, PII, structured output, tool selection |
92
+ | `praxo.toolcall` | `parse_tool_call`, `strip_tool_call_markup` |
93
+ | `praxo.jsonschema` | `Schema`, `ValidationError` |
94
+ | `praxo.plugin` | Manifest v1 parsing and validation |
95
+
96
+ Wire codecs preserve the Go names, including `image_url`, `runId`,
97
+ `contentBlocks`, and plugin `plugin_id`.
98
+
99
+ ## Conformance
100
+
101
+ From this directory:
102
+
103
+ ```bash
104
+ python conformance/run.py
105
+ python -m unittest discover -s tests -v
106
+ ```
107
+
108
+ Both commands read `../../spec/vectors/*.json`. A released SDK must pass every
109
+ vector and keep `spec/parity.md` current.
110
+
111
+ ## API Reference and Build
112
+
113
+ See [API.md](API.md). Refresh the checked-in symbol snapshot after a public API
114
+ change:
115
+
116
+ ```bash
117
+ python api-snapshot.py
118
+ python api-snapshot.py --check
119
+ python api-signatures.py --check
120
+ python -m build --wheel --sdist .
121
+ ```
122
+
123
+ The name snapshot and signature snapshot are checked independently. The
124
+ signature baseline covers class constructors, dataclass fields/defaults,
125
+ methods, properties, functions, and exported constants. Both are source-API
126
+ gates, not runtime or ABI guarantees.
127
+
128
+ CI installs the built wheel and sdist into separate clean virtual environments
129
+ and runs `tests/installed_smoke.py` from outside the source tree. This verifies
130
+ the packaged artifacts, not the checkout. It does not prove PyPI publication or
131
+ installation from a package registry.
132
+
133
+ ## License
134
+
135
+ MIT. See [LICENSE](../../LICENSE).
@@ -0,0 +1,117 @@
1
+ # PRAXO-CORE Python SDK
2
+
3
+ Python implementation of the PRAXO-CORE contract. The normative contract is
4
+ [`spec/`](../../spec/README.md); Go remains the reference implementation.
5
+
6
+ **Status:** Core plus streaming, context management, middleware, and an
7
+ OpenAI-compatible adapter. The package passes all eleven conformance vector
8
+ groups.
9
+ VFS and plugin hosts are not yet implemented. Wheel and sdist builds are
10
+ verified; PyPI publication is pending. Use the source installation below.
11
+
12
+ Package version: `0.2.1` source candidate; the latest released source tag is
13
+ `python/v0.2.0`. Supported contract: `SPEC_VERSION` `0.2.0`
14
+ (`praxo.SPEC_VERSION`).
15
+
16
+ ## Requirements
17
+
18
+ - Python 3.11 or newer
19
+ - No runtime dependencies
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ pip install ./language/python
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ ```python
30
+ import asyncio
31
+
32
+ from praxo.agent import Agent, AgentOptions, Session
33
+ from praxo.event import Event
34
+ from praxo.model import Message, Response, Usage
35
+ from praxo.tool import FuncTool, Registry
36
+
37
+
38
+ class EchoModel:
39
+ async def generate(self, request):
40
+ return Response(message=Message(role="assistant", content="hello"))
41
+
42
+
43
+ class LogSink:
44
+ async def emit(self, event: Event) -> None:
45
+ print(event.to_wire())
46
+
47
+
48
+ async def main() -> None:
49
+ tools = Registry()
50
+ tools.register(FuncTool("echo", "Echo input", lambda args: args))
51
+ agent = Agent(
52
+ AgentOptions(model=EchoModel(), tools=tools, events=LogSink())
53
+ )
54
+ result = await agent.run(Session(id="session-1"), "hi")
55
+ print(result.output, result.steps, result.usage)
56
+
57
+
58
+ asyncio.run(main())
59
+ ```
60
+
61
+ ## Contract Surface
62
+
63
+ | Module | Contract |
64
+ | --- | --- |
65
+ | `praxo.model` | `Model`, `Request`, `Response`, messages, tool specs, usage |
66
+ | `praxo.tool` | `Tool`, `Registry`, `FuncTool` |
67
+ | `praxo.event` | `Event`, `Sink`, `MultiSink`, `FilterSink` |
68
+ | `praxo.policy` | `Hook`, `Action`, `Decision`, `PathChecker` |
69
+ | `praxo.memory` | `Store`, `Record`, `MemoryStore`, `ContextAssembler` |
70
+ | `praxo.checkpoint` | `Checkpoint`, `Allowlist` |
71
+ | `praxo.agent` | `Agent`, `AgentOptions`, `Session`, `Result` |
72
+ | `praxo.context` | `ContextBudget`, `ModelSummarizer`, `Offloader`, `load_agents_md` |
73
+ | `praxo.middleware` | call limits, fallback, PII, structured output, tool selection |
74
+ | `praxo.toolcall` | `parse_tool_call`, `strip_tool_call_markup` |
75
+ | `praxo.jsonschema` | `Schema`, `ValidationError` |
76
+ | `praxo.plugin` | Manifest v1 parsing and validation |
77
+
78
+ Wire codecs preserve the Go names, including `image_url`, `runId`,
79
+ `contentBlocks`, and plugin `plugin_id`.
80
+
81
+ ## Conformance
82
+
83
+ From this directory:
84
+
85
+ ```bash
86
+ python conformance/run.py
87
+ python -m unittest discover -s tests -v
88
+ ```
89
+
90
+ Both commands read `../../spec/vectors/*.json`. A released SDK must pass every
91
+ vector and keep `spec/parity.md` current.
92
+
93
+ ## API Reference and Build
94
+
95
+ See [API.md](API.md). Refresh the checked-in symbol snapshot after a public API
96
+ change:
97
+
98
+ ```bash
99
+ python api-snapshot.py
100
+ python api-snapshot.py --check
101
+ python api-signatures.py --check
102
+ python -m build --wheel --sdist .
103
+ ```
104
+
105
+ The name snapshot and signature snapshot are checked independently. The
106
+ signature baseline covers class constructors, dataclass fields/defaults,
107
+ methods, properties, functions, and exported constants. Both are source-API
108
+ gates, not runtime or ABI guarantees.
109
+
110
+ CI installs the built wheel and sdist into separate clean virtual environments
111
+ and runs `tests/installed_smoke.py` from outside the source tree. This verifies
112
+ the packaged artifacts, not the checkout. It does not prove PyPI publication or
113
+ installation from a package registry.
114
+
115
+ ## License
116
+
117
+ MIT. See [LICENSE](../../LICENSE).