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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fresh_agent_core-0.1.0a1.tar.gz.
File metadata
- Download URL: fresh_agent_core-0.1.0a1.tar.gz
- Upload date:
- Size: 28.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99ca55caf9a934e4a49514de4385a90ad7a02d3a3bf06dc98b0e6d4575e8060d
|
|
| MD5 |
ffbd51f7818b96e652d5adb5cbc440e7
|
|
| BLAKE2b-256 |
9c5ef20973c36a770a010448aa45067644b8261e5c5b569ee5adc76e4db141fe
|
Provenance
The following attestation bundles were made for fresh_agent_core-0.1.0a1.tar.gz:
Publisher:
release.yml on UBC-FRESH/fresh-agent-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fresh_agent_core-0.1.0a1.tar.gz -
Subject digest:
99ca55caf9a934e4a49514de4385a90ad7a02d3a3bf06dc98b0e6d4575e8060d - Sigstore transparency entry: 2373523882
- Sigstore integration time:
-
Permalink:
UBC-FRESH/fresh-agent-core@0dd62ed5951d11700f4eb7e0947d906683c90144 -
Branch / Tag:
refs/tags/v0.1.0a1 - Owner: https://github.com/UBC-FRESH
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0dd62ed5951d11700f4eb7e0947d906683c90144 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fresh_agent_core-0.1.0a1-py3-none-any.whl.
File metadata
- Download URL: fresh_agent_core-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 22.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
568dc88f84017f3378f2cf59591774e18f62f332912efac45490cac9fa434391
|
|
| MD5 |
12b04aa7b498501c8abc2f11b5a30e49
|
|
| BLAKE2b-256 |
19e3e51db2de6657cd2775b7809f3b8ec1273f05205967c6f65b4616d5e4195d
|
Provenance
The following attestation bundles were made for fresh_agent_core-0.1.0a1-py3-none-any.whl:
Publisher:
release.yml on UBC-FRESH/fresh-agent-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fresh_agent_core-0.1.0a1-py3-none-any.whl -
Subject digest:
568dc88f84017f3378f2cf59591774e18f62f332912efac45490cac9fa434391 - Sigstore transparency entry: 2373524431
- Sigstore integration time:
-
Permalink:
UBC-FRESH/fresh-agent-core@0dd62ed5951d11700f4eb7e0947d906683c90144 -
Branch / Tag:
refs/tags/v0.1.0a1 - Owner: https://github.com/UBC-FRESH
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0dd62ed5951d11700f4eb7e0947d906683c90144 -
Trigger Event:
push
-
Statement type: