Skip to main content

Harnessed

PyPI version Python versions CI status License: MIT Status: Alpha

A Python agent SDK built from reversible plugins. Harnessed owns the loop, tool policies and explicit conversation state; optional provider integrations use PydanticAI's Direct API. Python 3.12-3.14, Pydantic v2 and modern generics.

Harnessed 0.x is alpha software. APIs and persisted session formats may change in minor releases before 1.0. See the release notes and compatibility policy.

Core SDK

uv add "harnessed[openai]"
import asyncio
from harnessed import Agent, Plugin, tool


class Calculator(Plugin):
    @tool(readonly=True)
    async def add(self, a: int, b: int) -> int:
        """Add two integers."""
        return a + b


agent = Agent(
    model="deepseek:deepseek-chat",  # DEEPSEEK_API_KEY
    system_prompt="Keep answers concise.",
    plugins=[Calculator()],
)


async def main():
    async with agent.session() as session:
        result = await session.run("What is 19 + 23?")
        print(result.text)


asyncio.run(main())

Agent composes model, system_prompt and plugins; plugin_validation controls how missing services are reported at startup. It is reusable; each session owns its runtime and plugin lifetimes.

  • Composition: tools, policies and capabilities are plugins. Libraries publish defaults with Kit; slots replace them and without() excludes recipe types. agent.describe() shows the resolved order, origins and replacement history.
  • Ownership: removing a plugin removes its registrations and effects. Explicit needs=(...) requirements suspend and rebuild mounts as services change. Inject[T] binds values; provides=True publishes the mounted plugin.
  • Context: explicitly ordered system sections are fixed per session; named context values and steering supply changes during a run.
  • State: export an immutable SessionState and inject it into the next run. Applications own persistence; completed conversations are not archived by the agent. Compaction retains only the active summary and selected context.

Continue a conversation

from harnessed import SessionState

# Inside an async function; your application owns the repository.
payload = await repository.load(conversation_id)
state = SessionState.from_json(payload) if payload is not None else None
result = await agent.run("Continue.", state=state)
await repository.save(conversation_id, result.state.to_json())

State includes retained context and referenced image/spill contents. Export and import perform no storage I/O. See sessions for ownership, compaction, live controls and independent continuations.

Test without credentials

from harnessed.testing import ScriptedModel, assert_tool_called, call, reply

model = ScriptedModel([call(Calculator.add, a=19, b=23), reply("42")])
agent = Agent(model=model, plugins=[Calculator()])

# Inside an async function:
# result = await agent.run("Add 19 and 23")
# assert_tool_called(result, "add", a=19, b=23)

Read by topic

Start with the documentation index or the SDK reference.

The standalone harnessed.kernel uses only the standard library. Optional features live under harnessed.plugins; providers live under harnessed.models.

Inspired by DeepSeek Harness and Cordis.

Released under the MIT License.

Metadata

Release files for harnessed 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for harnessed 0.9.0
File Size Uploaded Provenance Actions
harnessed-0.9.0.tar.gz 185.3 kB With provenance Details for harnessed-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for harnessed 0.9.0
File Interpreter ABI Platform Actions
harnessed-0.9.0-py3-none-any.whl Python 3 none any Details for harnessed-0.9.0-py3-none-any.whl

Total release size: 410.0 kB

Release files / harnessed-0.9.0.tar.gz

Download URL harnessed-0.9.0.tar.gz
Size 185.3 kB
Tags Source
SHA-256 checksum
How to use checksums
fd4727063d80a4137f7d26cf44678405dafcccc94da8111bb183220f91f7279f
BLAKE2b-256 checksum
How to use checksums
a2e9f80658897526745524c890734447e5db64e7ab8fd8e7480b45b3ea432232
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Release files / harnessed-0.9.0-py3-none-any.whl

Download URL harnessed-0.9.0-py3-none-any.whl
Size 224.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06614fb6b739f6154f304af1edeedb690930b06c62dae12aec62ef66107404a2
BLAKE2b-256 checksum
How to use checksums
8e935dac120e15652264403e69a9ffda5cdc8b3fd88cef72470c8b65be6912c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Security for harnessed 0.9.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for harnessed-0.9.0.tar.gz

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 Nov 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page