Skip to main content
Pre-release

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:

  1. 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.
  2. Capabilities are advisory. They return proposals; the caller applies them. That keeps a nondeterministic component out of the data path.
  3. 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 Capability contract 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:

  1. an explicit AgentConfig passed by the caller
  2. environment variables
  3. ~/.config/fresh-agent/config.toml
  4. otherwise unavailableavailable() returns False and capabilities raise AgentUnavailable
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

fresh_agent_core-0.1.0a1.tar.gz (28.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fresh_agent_core-0.1.0a1-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

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

Hashes for fresh_agent_core-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 99ca55caf9a934e4a49514de4385a90ad7a02d3a3bf06dc98b0e6d4575e8060d
MD5 ffbd51f7818b96e652d5adb5cbc440e7
BLAKE2b-256 9c5ef20973c36a770a010448aa45067644b8261e5c5b569ee5adc76e4db141fe

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fresh_agent_core-0.1.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for fresh_agent_core-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 568dc88f84017f3378f2cf59591774e18f62f332912efac45490cac9fa434391
MD5 12b04aa7b498501c8abc2f11b5a30e49
BLAKE2b-256 19e3e51db2de6657cd2775b7809f3b8ec1273f05205967c6f65b4616d5e4195d

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page