# Harness Agent Samples This folder demonstrates `create_harness_agent` — a factory function that builds a pre-configured, batteries-included agent by assembling the full agent pipeline from a chat client. ## What is `create_harness_agent`? `create_harness_agent` bundles the following features into a single `Agent` instance: | Feature | Description | |---------|-------------| | Function invocation | Automatic tool calling loop | | Per-service-call persistence | History persisted after every model call | | Compaction | Context-window management (sliding window + tool result compaction) | | TodoProvider | Todo list management for planning and tracking | | AgentModeProvider | Plan/execute mode tracking | | MemoryContextProvider | File-based durable memory (when `memory_store` provided) | | SkillsProvider | File-based skill discovery and progressive loading | | Shell tool | Shell command execution + environment probing (when `shell_executor` provided) | | Tool approval | "Don't ask again" standing rules + heuristic auto-approval (enabled by default) | | Looping | Re-invoke the agent until a `loop_should_continue` predicate is satisfied (when provided) | | OpenTelemetry | Built-in observability | Each feature can be disabled or customized via keyword arguments. ## Samples | File | Description | |------|-------------| | `harness_research.py` | Interactive research assistant with web search, a plan/execute workflow, and an execute-mode loop that re-invokes the agent until every todo is complete | | `harness_data_processing.py` | Data-processing assistant over a folder of CSV files, demonstrating file-access tools and tool approval | | [`build_your_own_claw/`](./build_your_own_claw/README.md) | *Build your own claw* blog series — a personal finance assistant built step by step | ## Running ```bash # Set your Foundry environment variables export FOUNDRY_PROJECT_ENDPOINT="https://your-project.services.ai.azure.com/api/projects/your-project-name" export FOUNDRY_MODEL="your-model-deployment-name" # Authenticate with Azure (required for AzureCliCredential) az login # Run a sample against the released agent-framework (PEP 723 isolated env) uv run samples/02-agents/harness/harness_research.py ``` ### Running against the local repo To run a sample against your **local** `agent-framework` checkout (so it picks up uncommitted changes), use the workspace environment instead of the isolated PEP 723 env. From the `python/` directory, run the script with `uv run python` and add the `textual` UI dependency the harness console needs: ```bash uv run --with textual python samples/02-agents/harness/harness_research.py uv run --with textual python samples/02-agents/harness/harness_data_processing.py ``` The workspace environment already provides the editable `agent-framework` packages plus the samples' other dependencies (`rich`, `python-dotenv`, `azure-identity`); only `textual` needs to be supplied with `--with`. > Note: invoking `uv run python