Harness Framework
Secure, fast, and economical agent harness for Microsoft Ecosystem.
One call, create_harness_agent(), gives an agent planning, memory, files,
skills, shell, web search and background agents, with bounded tool execution,
human approval and serializable session state. Use Agent.as_tool() for
synchronous delegation and the optional MCP provider for tools from configured
servers.
- 🧰 Complete harness: every piece is configurable and replaceable through extension points.
- 🔒 Secure: disk, network and process access are off until you enable them, and tools with side effects require approval by default.
- ⚡ Fast: async end to end, with three core dependencies and low per-turn overhead.
- 💰 Economical: compaction, token budgets and hard call limits keep cost predictable.
Installation
pip install harness-framework # core
pip install "harness-framework[openai]" # + OpenAI, Azure OpenAI and Foundry
pip install "harness-framework[redis]" # + Redis-backed history
pip install "harness-framework[mcp]" # + stdio and streamable HTTP MCP tools
Requires Python 3.12+. The import package is harness_framework.
Quick start
Runs offline. A scripted client drives the real tool loop.
import asyncio
from harness_framework import create_harness_agent, tool
from harness_framework.testing import ScriptedChatClient, function_call
@tool(side_effects=False)
def team_name() -> str:
"""Return the sample team name."""
return "Platform"
async def main() -> None:
client = ScriptedChatClient(
[
function_call("team_name"),
lambda messages, _: f"The team is {messages[-1].contents[0].result}.",
]
)
agent = create_harness_agent(client, tools=[team_name])
response = await agent.run("Which team is this?")
print(response.text) # The team is Platform.
asyncio.run(main())
Azure OpenAI with Microsoft Entra ID
DefaultAzureCredential uses az login locally and managed or workload
identity in Azure, so no API key is stored.
pip install "harness-framework[openai]" azure-identity
import asyncio
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
from openai import AsyncOpenAI
from harness_framework import create_harness_agent
from harness_framework.openai import OpenAIResponsesClient
async def main() -> None:
credential = DefaultAzureCredential()
get_token = get_bearer_token_provider(
credential, "https://cognitiveservices.azure.com/.default"
)
async def entra_token() -> str:
return await asyncio.to_thread(get_token) # fresh token per request
sdk = AsyncOpenAI(
api_key=entra_token,
base_url="https://<resource>.openai.azure.com/openai/v1/",
max_retries=0, # Harness Framework retries
)
try:
agent = create_harness_agent(OpenAIResponsesClient(model="<deployment>", async_client=sdk))
response = await agent.run("Say hello from Azure in five words.")
print(response.text)
finally:
await sdk.close()
credential.close()
asyncio.run(main())
The identity needs the Cognitive Services OpenAI User role. For OpenAI,
pass AsyncOpenAI() as async_client instead.
Harness
| Capability | Default | Boundary |
|---|---|---|
| Todos and plan/execute modes | On | A model-initiated mode change can only narrow tool access |
| File memory | On, in memory | No model writes to built-in stores after the turn is tainted |
| History and compaction | In memory | Bring a HistoryProvider (Redis or your own) |
| Tool approval | Required for side effects | Single-use, expiring, bound to the validated arguments |
| File access | Off | Confined workspace, bounded path globs and staged unified text patches |
| Skills | Off | Reviewed local paths; scripts need a runner |
| Shell | Off | ShellExecutor run in a host-isolated environment |
| Web search | Off | Taints the turn; max_searches caps calls per response |
| Background agents | Off | Inherit the parent's tool grant, taint and limits |
| Agent as a tool | Explicit Agent.as_tool() |
Fresh child session, approval and inherited limits |
| MCP tools | Off | Explicit server and tool selection, fresh human approval and untrusted results |
Security. Approval rule errors fail closed. Untrusted tool output and injected messages taint the turn and suppress automatic approval. Offering web search or MCP tools with offer taint enabled also taints the turn. Telemetry carries operation metadata.
Cost and speed. Every run has finite iteration, call, retry, timeout,
output and token limits. Configure a context budget to compact the transcript
and stop oversized requests. Responses API requests use store=False by default.
Synchronous tools and callbacks run in worker threads, so the event loop stays
responsive.
Security
Report vulnerabilities privately to the maintainers, not in a public issue.
License
Apache License 2.0. Copyright 2026 Nguyễn Trường Lâu and octopusai. See
LICENSE and NOTICE.
Metadata
Release files for harness-framework 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| harness_framework-0.1.0.tar.gz | 214.3 kB | Without provenance | Details for harness_framework-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| harness_framework-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for harness_framework-0.1.0-py3-none-any.whl |
Total release size: 466.2 kB
Release files / harness_framework-0.1.0.tar.gz
| Download URL | harness_framework-0.1.0.tar.gz |
|---|---|
| Size | 214.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
81483a4714cd215ec75e584e1ef0b4ebb340be12ef33994e8a1491b43f32d5a9
|
|
BLAKE2b-256 checksum How to use checksums |
18c87f14a12f18c23ee15eca94f685eefd1763c8bf7445f689675393790fa60b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / harness_framework-0.1.0-py3-none-any.whl
| Download URL | harness_framework-0.1.0-py3-none-any.whl |
|---|---|
| Size | 251.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
900356f13e51d76119b2b97c8cd568f3750cc301b7372ac3ff265b5e68e95430
|
|
BLAKE2b-256 checksum How to use checksums |
d2cf6268d8ba41f75e28ee20b95aa50519b855cb9fc30cb71c392001dc033bc0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for harness-framework 0.1.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.