This release is a pre-release and may not be stable for production use.
fresh-agent-core
Shared runtime for embedded agent capabilities across the UBC-FRESH modelling ecosystem.
A capability is a prompt plus a validator plus a retry budget. No oracle, no capability.
What problem this solves
The usual way an AI coding agent operates a library is: read the documentation, write Python, hope it composed the API correctly. The agent is outside the package, guessing at it. Every call is an unbounded generation problem whose only validator is "did it crash."
This package inverts that. A library ships its own agent-backed capabilities, and inside that boundary the library controls the prompt, the endpoint, and — crucially — validation of the model's output against its own real state.
The reliability does not come from embedding an LLM. It comes from a component inside the package being able to cheaply check the answer before returning it.
build prompt → call model → parse → validate against real state
↑ │
└──── feed failure back ────┘ (bounded retries)
Output that fails validation never reaches the caller. On exhaustion a
capability returns ok=False with the accumulated errors — never a best guess.
Three things follow:
- A small model suffices. Narrow task, hard oracle, bounded retries. The model only needs to emit plausible candidates cheaply. Frontier reasoning belongs wherever judgement is actually required, not here.
- Capabilities are advisory. They return proposals; the caller applies them. That keeps a nondeterministic component out of the data path.
- Every attempt is recorded — model, prompt hash, raw output, verdict, attempt number. In a scientific pipeline the log is the evidence.
What lives here, and what does not
This package owns the mechanism:
- configuration resolution and credential handling
- an OpenAI-compatible provider client
- the
Capabilitycontract and its validate/retry loop - provenance with secret redaction
FakeProvider, so adopting packages can test entirely offline- a generic MCP host
It owns no domain knowledge. The validator is the domain-specific part and
belongs in the adopting package — only ws3 knows what makes a ws3 mask valid.
fresh_agent_core must never import ws3, femic, fhops, or freshforge.
Dependencies point one way.
Install
pip install fresh-agent-core
Configure
Resolution order, first hit wins:
- an explicit
AgentConfigpassed by the caller - environment variables
~/.config/fresh-agent/config.toml- otherwise unavailable —
available()returnsFalseand capabilities raiseAgentUnavailable
export FRESH_AGENT_ENDPOINT="https://your-host/v1"
export FRESH_AGENT_MODEL="your-model-id"
export FRESH_AGENT_API_KEY="..." # optional
export FRESH_AGENT_HEADERS='{"X-Trace": "abc"}' # optional, JSON
Or:
# ~/.config/fresh-agent/config.toml
[agent]
endpoint = "https://your-host/v1"
model = "your-model-id"
timeout = 60.0
Nothing about any particular endpoint is hardcoded, and credentials are read from the environment or user config only — never from a repository.
import fresh_agent_core as fac
if fac.available():
... # capabilities usable
available() never raises and never touches the network. It answers "is this
configured", not "is the endpoint reachable" — reachability is only knowable by
making a call, and this probe has to be cheap enough to sit inside an if.
Testing offline
The critical assertion for any capability is "invalid model output never escapes the loop." You cannot make that assertion without scripting invalid output:
from fresh_agent_core import FakeProvider
provider = FakeProvider([
"not valid json at all", # malformed
'{"mask": "? ? ? nonexistent"}', # well-formed, but fails validation
'{"mask": "? ? ? real"}', # finally valid
])
A capability that only survives well-formed input has not been tested.
Status
Alpha. Under active development as part of ws3 Phase 8.
Licence
MIT.
Metadata
Release files for fresh-agent-core 0.1.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fresh_agent_core-0.1.0a1.tar.gz | 28.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fresh_agent_core-0.1.0a1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 51.2 kB
Release files / fresh_agent_core-0.1.0a1.tar.gz
| Download URL | fresh_agent_core-0.1.0a1.tar.gz |
|---|---|
| Size | 28.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
99ca55caf9a934e4a49514de4385a90ad7a02d3a3bf06dc98b0e6d4575e8060d
|
|
BLAKE2b-256 checksum How to use checksums |
9c5ef20973c36a770a010448aa45067644b8261e5c5b569ee5adc76e4db141fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logRelease files / fresh_agent_core-0.1.0a1-py3-none-any.whl
| Download URL | fresh_agent_core-0.1.0a1-py3-none-any.whl |
|---|---|
| Size | 22.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
568dc88f84017f3378f2cf59591774e18f62f332912efac45490cac9fa434391
|
|
BLAKE2b-256 checksum How to use checksums |
19e3e51db2de6657cd2775b7809f3b8ec1273f05205967c6f65b4616d5e4195d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency log