packages feed

praxo-core-0.12.1 / README.md

# PRAXO-CORE Haskell CorePRAXO-CORE is an embeddable, MIT-licensed AI agent framework. This package is itsnative Haskell Core. It implements all eleven declared vector groups and does notcall Go or another Core. It includes a native callback-based agent loop withtools, policy hooks, typed events, memory, checkpoints, context budgets,middleware, JSON Schema validation, plugin manifest parsing, and runtime helpers.- Implementation type: Core.- Source version: `0.12.1`; Hackage publishes `0.11.0`.- Supported `SPEC_VERSION`: `0.2.0`. Migrating from `0.9.0` requires binding  `pathChecker`, `pathCheck`, and `pathAllowed` in `IO`; see [CHANGELOG.md](CHANGELOG.md).- Local gate: all eleven shared vector groups, native regression tests, and  source API/parity checks.- Linux and Windows CI run the full suite. Hackage publication uses  `.github/workflows/release-haskell.yml`; production readiness is not implied  by the source tag.PRAXO-CORE (also written praxocore) provides an embeddable, MIT-licensed agent framework for Haskell, with tool calling, policy hooks, human-in-the-loop approval, checkpoints, and execution events. Use the language-specific scope and verification evidence below; a package listing does not establish Go feature parity or production readiness.## Registry and Coding-Agent Entry- Get started, prerequisites, and installation: [language documentation](https://axisvela.github.io/praxo-core/languages/haskell/)- [Examples](https://github.com/axisvela/praxo-core/tree/main/language/haskell/examples): runnable language-specific examples; see each README for prerequisites and verification.- [Scenario tutorials](https://github.com/axisvela/praxo-core/tree/main/language/haskell/Tutorial): read the scope and validation status; source is not portfolio acceptance.- Reference applications: no language-specific accepted end-to-end application recorded; see the [tutorial catalog](https://axisvela.github.io/praxo-core/getting-started/tutorial-catalog/).- Registry introduction: [REGISTRY.md](https://github.com/axisvela/praxo-core/blob/main/language/haskell/REGISTRY.md)- Machine-readable entry: [llms.txt](https://github.com/axisvela/praxo-core/blob/main/language/haskell/llms.txt) and [llms.md](https://github.com/axisvela/praxo-core/blob/main/language/haskell/llms.md)- Coding-agent contract: [docs/getting-started/coding-agents.md](https://github.com/axisvela/praxo-core/blob/main/docs/getting-started/coding-agents.md)- Registry: [Hackage](https://hackage.haskell.org/package/praxo-core-0.11.0)- Community: [X](https://x.com/axisvela) · [Weibo](https://weibo.com/u/1936025761) · [LinkedIn](https://www.linkedin.com/company/axisvela/) · [Facebook](https://www.facebook.com/profile.php?id=61596905732406) · [YouTube](https://www.youtube.com/@axisvela) · [Discord](https://discord.com/channels/1575163993767809064/1575164343148875977) · [GitHub Discussions](https://github.com/axisvela/praxo-core/discussions) · [GitHub Issues](https://github.com/axisvela/praxo-core/issues) · [Documentation](https://axisvela.github.io/praxo-core/) · [Architect](https://axisvela.architect.pub)## Get startedInstall the published package:```bashcabal install --lib praxo-core-0.11.0```Then run the smallest deterministic example:- [Consumer starter](https://github.com/axisvela/praxo-core/tree/main/language/haskell/examples/consumer): explicit tool scope and a deny check.- [Live model](https://github.com/axisvela/praxo-core/tree/main/language/haskell/examples/live-model): connect an OpenAI-compatible endpoint and register `get_time`.See the [Haskell documentation](https://axisvela.github.io/praxo-core/languages/haskell/) for the full API and the[language matrix](https://axisvela.github.io/praxo-core/languages/matrix/) forcurrent scope.## ExamplesRunnable examples live under [`language/haskell/examples`](https://github.com/axisvela/praxo-core/tree/main/language/haskell/examples).| Goal | Example || --- | --- || Install and deny one unsafe call | [consumer](https://github.com/axisvela/praxo-core/tree/main/language/haskell/examples/consumer) || Connect a real model | [live-model](https://github.com/axisvela/praxo-core/tree/main/language/haskell/examples/live-model) || Connect MCP tools | [mcp](https://github.com/axisvela/praxo-core/tree/main/language/haskell/examples/mcp) || Validate structured output | [structured-output](https://github.com/axisvela/praxo-core/tree/main/language/haskell/examples/structured-output) || Stream a response | [streaming](https://github.com/axisvela/praxo-core/tree/main/language/haskell/examples/streaming) || Add identity and policy | [identity-policy](https://github.com/axisvela/praxo-core/tree/main/language/haskell/examples/identity-policy) || Persist checkpoints | [checkpoint](https://github.com/axisvela/praxo-core/tree/main/language/haskell/examples/checkpoint) || Run behind HTTP | [service](https://github.com/axisvela/praxo-core/tree/main/language/haskell/examples/service) || Retry transient failures | [retry](https://github.com/axisvela/praxo-core/tree/main/language/haskell/examples/retry) || Add provider fallback | [provider-fallback](https://github.com/axisvela/praxo-core/tree/main/language/haskell/examples/provider-fallback) || Observe agent events | [event-sink](https://github.com/axisvela/praxo-core/tree/main/language/haskell/examples/event-sink) || Require human approval | [hitl](https://github.com/axisvela/praxo-core/tree/main/language/haskell/examples/hitl) || Run the representative chain | [representative-chain](https://github.com/axisvela/praxo-core/tree/main/language/haskell/examples/representative-chain) || Apply governed delegation | [advanced-delegation](https://github.com/axisvela/praxo-core/tree/main/language/haskell/examples/advanced-delegation) |## Build and TestUse GHC 9.0 or newer and Python 3.10 or newer. CI targets GHC 9.12.2 on Linuxand Windows. From the repository root:```bashpython language/haskell/run-tests.pypython language/haskell/api-snapshot.py --check```Set `GHC` or pass `--compiler /path/to/ghc` to select the compiler. Python onlybuilds and launches the native programs; it does not implement their behavior.Generated files stay under `language/haskell/build/`.For a Cabal source build, from `language/haskell/`:```bashcabal build --offline allcabal test --offlinecabal run --offline praxo-haskell-conformance -- ../../spec```The library depends only on GHC's `base` and `containers` packages. No provider,JSON, or regular-expression package is downloaded by the native test driver.Offline Cabal builds require those boot packages to be available with GHC.## Usage```haskellimport Praxo.Jsonimport Praxo.JsonSchemaimport Praxo.ToolCallmain :: IO ()main = do    print (parseToolCall "{\"name\":\"echo\",\"input\":{\"text\":\"hello\"}}")    print (validateSchema (JObject [("type", JString "string")]) (JNumber 42))    print (encodeJson (JObject [("runId", JString "run-1")]))```Public declarations are inventoried in [`api/0.1.0.txt`](api/0.1.0.txt).This is a source declaration check, not a binary ABI promise. Intentional APIchanges require review and regeneration with `python api-snapshot.py`.## OpenAI-Compatible Adapter`Praxo.OpenAICompatible` builds a `POST {baseUrl}/chat/completions` request withmessages, tools, tool choice, assistant tool calls, and token usage, and mapsprovider HTTP failures to `PROVIDER_HTTP`. `generateStream` sets `stream: true`,\nparses SSE, reassembles content, fragmented tool calls, and usage, and calls\nthe delta callback. Set `onDelta` and `generateStream` on `AgentOptions` to use\nit through the agent.```haskellimport qualified Praxo.Agent as Aimport Praxo.Jsonimport Praxo.OpenAICompatibleadapter :: Transport -> OpenAIConfigadapter transport = OpenAIConfig    { openAIBaseURL = "https://api.example.com/v1"    , openAIModel = "provider-model-id"    , openAIKey = Just "secret"    , openAIToolChoice = Just "auto"    , openAITools = []    , openAITransport = transport    }main :: IO ()main = do    result <- generate (adapter myTransport) [A.Message "user" "hello" [] ""]    print result```The adapter does not bundle an HTTP client, so the library keeps its `base` and`containers` dependency set. Supply a synchronous `Transport` that performs theHTTP exchange for production or tests; deterministic tests use a fake transport.The Core `Response` type has no finish-reason field, so `finish_reason` isignored.## Anthropic and Gemini AdaptersPraxo.Anthropic and Praxo.Gemini build native Messages andgenerateContent requests with the same injected Transport seam.`haskellimport qualified Praxo.Anthropic as Animport qualified Praxo.Gemini as G`They map tool calls, tool schemas, usage, and provider errors.`generateAnthropicStream` and `generateGeminiStream` reassemble SSE. No HTTP client is bundled.## Harmovela Event Sink`Praxo.Harmovela` posts Core events to `POST {baseURL}/events` with thedocumented envelope (`spec_version`, `id`, `type`, `source`, `created_at`,`payload`). Supply a transport and a UTC nanosecond clock; the package keeps its`base` and `containers` dependency set and does not bundle an HTTP client.```haskellimport qualified Praxo.Harmovela as Hsink :: H.HarmovelaTransport -> IO Integer -> H.HarmovelaSinksink transport clock = H.newHarmovelaSink    "http://127.0.0.1:8790/aep/api"    transport    clock````emitHarmovelaEvent` accepts any 2xx response and returns `HARMOVELA_HTTP` withthe status and a bounded body otherwise. The sink adds no authentication,retries, buffering, ordering, or exactly-once delivery. Event data may containsensitive content, so filter caller-side; use HTTPS for remote endpoints.## Human-in-the-Loop Approval`AgentOptions` accepts `interruptOn`, `onInterruptDecision`, and `onInterrupt` topause matching tool calls. The agent checks allowed tools, runs the initialpolicy, applies `beforeTool`, and then applies the interrupt before `tool.call`and `invoke`.```haskellimport Praxo.Agentimport Praxo.Jsonoptions :: AgentOptions -> AgentOptionsoptions base = base    { interruptOn = ["write_note"]    , onInterruptDecision = Just $ \interrupt ->        pure (InterruptDecision interruptEdit            (Just (JObject [("text", JString "hello"),                            ("visibility", JString "private")]))            "" "")    }```Decisions are `interruptApprove` (continue), `interruptEdit` (replace argumentsand reauthorize), `interruptReject` (return `AGENT_APPROVAL_DENIED` with thereason), and `interruptRespond` (skip the tool and use the response). A matchingcall with no handler returns `AGENT_INTERRUPT_UNHANDLED`; an unknown action oran edit without arguments returns `AGENT_INTERRUPT_DECISION_INVALID`. The policyhook receives an `Action` so edited arguments are reauthorized. See[`language/go/examples/hitl`](language/go/examples/hitl/).## Declared Scope and Limits- JSON parsing is strict, rejects malformed escapes and lone surrogates, and  bounds input to 1,048,576 Haskell characters and nesting to 64. Numbers use  exact rationals with bounded decimal spelling/exponents. Encoding rejects  non-terminating decimal rationals and invalid Unicode scalars.- JSON object equality is order-independent and uses the last duplicate key.  Plugin manifests additionally reject duplicate fields to avoid ambiguity.- Tool calls support canonical JSON, closed XML-style blocks, closed dotted  tags, and dotted plain lines. Governance metadata is preserved as strings.  No call ID is generated. DSML, invoke, todo, and skill-install formats are not  implemented. Tool-call input is limited to 262,144 characters; oversized input  is not parsed, and the stripping helper returns it unchanged. This helper is  not a security sanitizer. Do not infer full Go parser parity from the vectors.- JSON Schema supports object properties/required fields, array items and  lengths, scalar types, enum, numeric bounds, and Unicode code-point lengths.  The reference's zero-bound behavior is preserved. Unknown keywords are ignored.- Patterns support ASCII literals, dot, ranges/classes, anchors, `*`, `+`, `?`,  and basic escaped classes. This is not full RE2. Unsupported syntax fails  explicitly; work is bounded by pattern and input size. Pattern failures such  as `SCHEMA_PATTERN_UNSUPPORTED` are Core-local, not new wire error codes.  Other `Left` diagnostic strings are also Core-local rather than wire envelopes.- Plugin checks cover declared manifest fields, entrypoint/isolation, limits,  permissions, health, capabilities, and signature/SBOM declarations. They do  not execute plugins, verify signatures, establish trust, or enforce OS confinement.- The loop accepts model, tool, and event callbacks returning explicit errors.  It runs tools sequentially, preserves message history, and enforces step and  cumulative input/output token budgets. Negative model-reported input or output  counts fail with the Core-local `AGENT_INVALID_USAGE` error and a `run.failed`  event before that response's tools run, even when the token budget is disabled.  The loop relies on callbacks to report accurate non-negative usage; it cannot  independently verify counts. Callbacks must return errors rather  than throw exceptions; exceptions are not converted to agent errors. Tool  lookup and validation are the caller's responsibility. Events contain only  their kind, not full wire event envelopes. There is no asynchronous streaming  runtime, cancellation, or concurrent session management.- `Praxo.Runtime` provides memory, event sinks, checkpoints, lexical path policy,  context compaction, and stream-kind constants. `Praxo.Middleware` provides PII  redaction, structured-output validation, call limits, tool selection, and  fallback helpers. The callback-based agent loop does not automatically apply  these opt-in helpers.- The OpenAI-compatible adapter requires a caller-supplied transport and does  not implement streaming. There is no asynchronous event stream or plugin host  in this Core. Generic JSON can preserve wire field names; typed codecs for  other contract envelopes are not claimed.See the [normative specification](../../spec/README.md),[parity inventory](../../spec/parity/haskell.md), and[language policy](../../docs/contributing/language-policy.md).The parity inventory records the implemented Core surfaces.See [SETUP.md](SETUP.md) for local setup and test commands.## Tutorials and Reference ApplicationsLanguage-specific scenario tutorials and reference applications for Haskell.### Scenario Tutorials| Tutorial | What it shows || --- | --- || [literature-review](https://github.com/axisvela/praxo-core/tree/main/language/haskell/Tutorial/literature-review) | A bounded first slice of [SC-01](https://axisvela.github.io/praxo-core/getting-started/agent-scenarios/), not autonomous scientific discovery. It searches a fixed synthetic pape... || [policy-simulation](https://github.com/axisvela/praxo-core/tree/main/language/haskell/Tutorial/policy-simulation) | A bounded first slice of OG-02, not a policy-prediction engine. It simulates a small fixed synthetic population and drafts a review-only sensitivity report using the source Hask... || [rule-dsl](https://github.com/axisvela/praxo-core/tree/main/language/haskell/Tutorial/rule-dsl) | A bounded business-rule validation tutorial. It parses a small access-rule DSL into a typed Haskell structure, detects allow/deny conflicts and returns a counterexample. Core co... || [test-generation](https://github.com/axisvela/praxo-core/tree/main/language/haskell/Tutorial/test-generation) | A bounded first slice of SE-04, not a test-execution or load-testing service. It generates three bounded tests for a fixed local fixture and records zero executions. No load tar... |Index: [language/haskell/Tutorial](https://github.com/axisvela/praxo-core/tree/main/language/haskell/Tutorial).### Reference ApplicationsNo accepted end-to-end reference application is recorded for this language yet. Candidate goals are tracked in the [Reference Application Portfolio](https://axisvela.github.io/praxo-core/project/planning/roadmap/#reference-application-portfolio).Planning context: [Tutorial Plan](https://axisvela.github.io/praxo-core/getting-started/tutorial-plan/), [100 candidate agent scenarios](https://axisvela.github.io/praxo-core/getting-started/agent-scenarios/), and [Tutorial Catalog](https://axisvela.github.io/praxo-core/getting-started/tutorial-catalog/). Chinese: [教程计划](https://axisvela.github.io/praxo-core/zh-CN/getting-started/tutorial-plan/), [候选场景](https://axisvela.github.io/praxo-core/zh-CN/getting-started/agent-scenarios/), [教程目录](https://axisvela.github.io/praxo-core/zh-CN/getting-started/tutorial-catalog/).## Community- X: <https://x.com/axisvela>- Weibo: <https://weibo.com/u/1936025761>- LinkedIn: <https://www.linkedin.com/company/axisvela/>- Facebook: <https://www.facebook.com/profile.php?id=61596905732406>- YouTube: <https://www.youtube.com/@axisvela>- Discord: <https://discord.com/channels/1575163993767809064/1575164343148875977>- GitHub Discussions: <https://github.com/axisvela/praxo-core/discussions>- GitHub Issues: <https://github.com/axisvela/praxo-core/issues>- Documentation: <https://axisvela.github.io/praxo-core/>- Architect: <https://axisvela.architect.pub>## LicenseMIT. See [LICENSE](LICENSE). `base` and `containers` use BSD-style licenses;GHC and its runtime are separate toolchain components, not vendored code.