category
Disclosure: I maintain PRAXO-CORE. This article reflects the 2.10.0 source state; it is not a production or security certification.
The default answer for Fortran and AI is: port the model to Python.
It sounds reasonable. Python has the agent libraries, the model clients, the
tooling, and the hiring pool. Fortran has the model. Move the model to where the
agent ecosystem lives.
But a validated Fortran model is not just syntax. It is a numerical kernel, a set
of libraries, a performance profile, a set of regression cases, and often a
regulatory or scientific validation history. Porting it to Python is not a
refactor. It is a revalidation program.
PRAXO-CORE is testing a different answer: keep the model in Fortran, and put a
governed agent loop inside the same process.
Not a bridge. Not a Python wrapper. A native Fortran 2008 implementation of the
agent contract.
The third path
The usual integration pattern is a sidecar. A Python service owns the agent loop,
and the Fortran model exposes a tool or an API. This is often the right
engineering choice. It isolates the new runtime and avoids touching a validated
simulation code.
But the governance boundary moves with the agent. Policy, tool authorization,
checkpoints, audit events, and human approval now live in the sidecar. Every
control has to cross a process or network boundary. That can be made to work, but
it is a larger integration surface than it first appears.
The third path is to put the loop where the model already lives. The Fortran
program calls the agent loop, passes a prompt and options, dispatches tools,
applies policy, and receives a result. The model keeps its runtime. The agent
meets it there.
This is a narrower claim than “AI for Fortran” and a more useful one: a governed
loop inside the process that already owns the simulation and its validation.
What native Fortran means
The Fortran SDK is implemented in Fortran 2008. It is not a bridge to Go, C,
Python, or another SDK. The agent loop, JSON parsing, schema validation,
tool-call parsing, context estimation, checkpoint envelopes, memory, policy,
events, middleware, and PII redaction are native Fortran modules.
The current target is GNU Fortran. Python 3.10 or later is used by the test
driver to translate the declared JSON fixtures into Fortran test inputs and
assertions; every behavior under test runs in the compiled Fortran
implementation. A compiled Core consumer does not need Python at runtime.
The source tag is fortran/v0.11.0. It is a source release, not a
package-registry release. The Core sources are MIT-licensed; GNU Fortran and its
runtime are separately licensed external toolchain dependencies.
Architecture
The API is organized as Fortran modules:
| Module | Surface |
|---|---|
praxo_types |
Messages, calls, requests, responses, usage, sessions, events, decisions, results, errors |
praxo_interfaces |
Abstract model, tool, policy, event sink; tool registry |
praxo_agent |
Agent options and bounded agent loop |
praxo_context |
Token estimate and context compaction |
praxo_runtime |
Recording, filter, and multi event sinks; in-memory store |
praxo_unicode, praxo_json |
Native UTF-8, JSON parsing, encoding, traversal, equality |
praxo_checkpoint |
Registered-type JSON envelopes |
praxo_toolcall |
JSON, XML-style, dotted-tag, and plain tool-call parsing; markup removal |
praxo_schema, praxo_pattern |
Contract schema validation and bounded ASCII patterns |
praxo_policy |
Lexical path grants |
praxo_plugin |
Strict manifest parsing and validation |
praxo_middleware |
Per-run limits, tool selection, fallback, structured-output repair, PII redaction |
praxo_stream |
Stream-kind constants and part record |
The core call is small:
options%provider => provider
options%tools => tools
options%events => sink
call run_agent(options, state, 'hello', 'caller-generated-run-id', result, error)
if (error%failed()) print *, error%code
Callback targets must remain alive for the run. multi_sink%add and
filter_sink%target retain pointers, so their targets must outlive the sink. The
registry owns a polymorphic copy of each registered tool; pointer components
inside a user-defined tool retain the caller’s lifetime obligations. Each run has
local history and does not mutate the input session or options. Sharing a mutable
model, registry, store, or sink across threads requires caller-managed
synchronization.
The caller supplies a unique run ID, which is preserved in results and events.
Zero or negative step limits select eight steps. A nonpositive token limit
disables the usage budget. Model and tool failures propagate; denied policy
actions fail before the corresponding invocation. Context compaction is checked
before each model invocation. Negative usage and counter overflow fail closed.
The limits
The Fortran SDK is explicit about its boundaries:
- JSON documents are limited to 262,144 input bytes, 4096 value nodes, and 64
nested containers. - Invalid UTF-8, lone surrogates, malformed numbers, and trailing data are
rejected. - Duplicate object keys are retained; lookup and equality use the last value.
- Schema patterns support ASCII literals, dot, character classes/ranges, anchors,
and*,+,?, plus basic escaped classes. This is not full RE2. Groups,
alternation, counted repetitions, Unicode pattern matching, and unsupported
escapes fail explicitly withSCHEMA_PATTERN_UNSUPPORTED. - Path policy is lexical normalization, not OS confinement. It does not resolve
symlinks, reparse points, filesystem case rules, or races. - Plugin parsing validates declarations; it does not execute plugins or verify
signatures. - Stream support provides the part record and six contract kind strings, not an
asynchronous agent stream. - Memory search uses ASCII case folding and lexical ordering of canonical UTC
timestamps. - PII redaction covers email, SSN, credit-card, and phone patterns. It is not a
complete compliance program. - Multimodal message blocks and optional Go hooks not listed in the parity
inventory are not implemented.
The bounded JSON Schema subset remains partial in the parity inventory; the
stream part is parity, while some P2 stream options remain partial. The rest of
the declared Core scope passes.
What it does not do
- It is not full Go feature parity.
- It is not a package-registry release.
- It ships an OpenAI-compatible adapter over a caller-supplied transport; no bundled HTTP client.
- It does not provide an asynchronous runtime; stream callbacks and an SSE parser exist.
- It does not provide full JSON Schema coverage.
- It does not provide OS-level sandboxing.
- It does not provide general PII compliance.
- It does not verify signatures or embed a plugin runtime; process integration remains a caller/transport boundary.
- It does not claim MPI, OpenMP, GPU, netCDF, HDF5, or domain-library
integration. - It does not claim production readiness for your model or deployment.
These limits are not footnotes. They are the boundary that makes the native claim
credible.
Governance and reproducibility
A research group or regulated model owner does not need an agent that can talk
about Fortran. It needs an agent that can participate in a process without
bypassing the controls around that process.
That means:
- policy hooks that see the final tool arguments;
- explicit tool authorization, including a second check after middleware edits;
- checkpoints that support recovery;
- structured events for audit and telemetry;
- human-in-the-loop approval at the right boundary;
- a clear statement of what the framework does not own.
If the loop lives in the Fortran process, the number of places where a policy
decision can get lost is smaller. The model, the tool, and the approval boundary
can stay close together.
That does not automatically make the system reproducible or secure. It reduces
one kind of boundary crossing. The rest is engineering and validation.
How to evaluate
Do not start with “AI in Fortran.” Start with the Fortran README and the matrix.
- Confirm the tier, tag, and current scope.
- Run
python language/fortran/run-tests.pywith GNU Fortran. - Read the 256 KB / 4096 / 64 limits and decide whether they fit your workload.
- Check the parity inventory for the partial stream and schema surfaces.
- Test the security behavior you actually depend on: path handling, policy
ordering, cancellation, and callback failure. - Decide whether a native loop, a bridge, or a sidecar is the right fit.
Repo: https://github.com/axisvela/praxo-core
Fortran docs: https://axisvela.github.io/praxo-core/languages/fortran/
Fortran source: https://github.com/axisvela/praxo-core/tree/main/language/fortran
Matrix: https://github.com/axisvela/praxo-core/blob/main/spec/languages.md
Invitation
The interesting question is not “Can Fortran call a model?” It can.
The interesting question is whether a governed agent loop can be made dependable
in the process that already owns a validated numerical model — and whether the
partial surfaces can be stated clearly enough that an operator trusts the failure
modes.
If you run Fortran simulation, research, or numerical code, I would value the
hard questions. What would you test first? Which boundary should be native, and
which should stay behind a bridge? What would you need to see before letting an
agent call a production tool from Fortran?
That conversation is more useful than another porting demo.
- 登录 发表评论
- 6 次浏览
Tags
最新内容
- 1 day 9 hours ago
- 1 day 9 hours ago
- 1 day 9 hours ago
- 1 day 9 hours ago
- 1 day 9 hours ago
- 1 day 9 hours ago
- 1 day 9 hours ago
- 1 day 9 hours ago
- 1 day 9 hours ago
- 1 day 9 hours ago