PRAXO-CORE Erlang Core

PRAXO-CORE is an embeddable, MIT-licensed agent framework. This package is its native Erlang Core with source tag erlang/v0.8.2. It passes all eleven shared vector groups on Erlang/OTP 29 and includes the native agent loop, memory store, checkpoint allowlist, lexical path policy, context compaction, event sinks, middleware helpers, tool selection, and human-in-the-loop interrupt decisions. It does not call Go or another Core.

Registry and Coding-Agent Entry

Get started

Install the published package:

{praxo_core, "0.8.2", {pkg, praxo_core_erlang}}

Then run the smallest deterministic example:

See the Erlang documentation for the full API and the language matrix for current scope.

Examples

Runnable examples live under language/erlang/examples.

Goal Example
Install and deny one unsafe call consumer
Connect a real model live-model
Connect MCP tools mcp
Validate structured output structured-output
Stream a response streaming
Add identity and policy identity-policy
Persist checkpoints checkpoint
Run behind HTTP service
Approve or edit a tool call hitl
Resume a multi-turn session session-checkpoint
Retry transient failures retry
Add provider fallback provider-fallback
Observe agent events event-sink

Install

{deps, [{praxo_core, "0.8.2", {pkg, praxo_core_erlang}}]}.

Build and Test

From the repository root:

python language/erlang/run-tests.py
python language/erlang/api-snapshot.py --check

Set ERLC and ERL to select the compiler and runtime. The Python runner only launches erlc, erl, and the API checks; the implementation and tests are Erlang. Build output stays under language/erlang/build/ebin/.

To build manually from language/erlang/:

erlc -I src -o build/ebin src/*.erl conformance/*.erl tests/*.erl
erl -noshell -pa build/ebin -eval "praxo_conformance:main()." -s init stop
erl -noshell -pa build/ebin -eval "praxo_tests:run()." -s init stop

Usage

Model = praxo_agent:static_model(<<"hello">>),
Options = praxo_agent:new_agent_options(Model),
{ok, Result, _Options} =
    praxo_agent:run_agent(Options, praxo_models:session(<<"demo">>), <<"hello">>),
io:format("~s~n", [maps:get(output, Result)]).

OpenAI-Compatible Adapter

praxo_openai_compatible provides a non-streaming adapter over the native model seam. It posts to {base_url}/chat/completions and maps assistant content, tool calls, and token usage. Inject transport to run without network access; it receives (Path, Payload) and returns {ok, DecodedJson}.

Adapter = praxo_openai_compatible:new(
    <<"https://api.example.com/v1">>, <<"model-id">>,
    #{api_key => <<"token">>}),
Request = praxo_models:request([praxo_models:message(<<"user">>, <<"hi">>)]),
{ok, Response, _} = praxo_openai_compatible:generate(Adapter, Request),
Model = praxo_openai_compatible:model(Adapter).

Provider HTTP failures return {error, <<"PROVIDER_HTTP">>, Adapter}; invalid tool-argument JSON returns PROVIDER_JSON. Streaming is not implemented.

Public declarations are inventoried in api/0.4.0.txt. This is a source declaration check, not a binary ABI promise. Regenerate it with python api-snapshot.py.

Anthropic and Gemini Adapters

praxo_anthropic and praxo_gemini map the native Messages and generateContent APIs. Both accept a caller-supplied transport for deterministic tests.

Anthropic = praxo_anthropic:new(<<"claude-sonnet-4-5">>, <<"ak">>),
Gemini = praxo_gemini:new(<<"gemini-2.5-pro">>, <<"gk">>),

MCP Client

praxo_mcp implements a stdio JSON-RPC MCP session with initialize, paginated tool listing, tool calls, timeouts, cancellation notifications, and an injectable transport for deterministic tests.

Harmovela Event Sink

praxo_harmovela posts each event to {base_url}/events.

Sink = praxo_harmovela:new(<<"http://127.0.0.1:8790/aep/api">>),
Event = praxo_models:event(<<"tool.call">>, <<"s1">>, <<"run-1">>, #{<<"name">> => <<"echo">>}),
ok = praxo_harmovela:emit(Sink, Event).

The returned map is also a praxo_sink sink, so events => Sink works with the agent loop. Inject transport (and clock) in the options map to test without a network. A 2xx status returns ok; other statuses return {error, {http_status, Status, BoundedBody}} from praxo_harmovela:emit/2. The sink adds no authentication, retries, buffering, ordering, or exactly-once delivery. Use HTTPS and filter sensitive event data first.

Current Limits

The source is MIT; see LICENSE. Erlang/OTP is a separate toolchain, not vendored code.

See CHANGELOG.md for per-release changes and compatibility notes.

See language policy, parity inventory, SETUP.md, and implementation support.