# What the agent harness does > The agent harness runs your own agent loop on your own model key, with Harny handling memory, actions, permissions and a record. An agent loop is the repeating cycle in which a model reads the task, picks an action and sees the result, until the job is done. The harness is the part that runs that cycle for you. To use Harny for memory only, skip the harness: the [Memory API](/docs/memory-api/overview) works on its own. The harness is part of the Python SDK, `pip install harny`, in the module `harny.agent`. It needs Python 3.10+. You write the agent's instructions and choose its actions. The harness runs the loop and checks each action against your app's permission settings. ## What Harny holds and what you hold | Harny holds | You hold | |---|---| | Each person's memory and connected accounts | Your model key. Harny never sees it. | | App permission settings | The agent instructions in your code | | A record of every action | Your session store and any long-job folder | Each app's data is separate, and each person's memory is separate. ## The loop Your code calls `agent.run(user=..., message=...)`. The harness calls your model and runs the actions the model asks for. Each action goes through the permission settings first. An action that needs a yes comes back as a pending confirmation. Your code approves or refuses it with `agent.confirm(...)`, never through the model. ```python import asyncio from harny import HarnyClient from harny.agent import Agent, AgentConfig, FileSessionStore async def main(): async with HarnyClient(api_key="fsa_...") as harny: # your app key, read from the environment in real code agent = await Agent.create( harny=harny, preset="cost_first", # resolved against Harny's model roster config=AgentConfig(instructions="You help one person with their calendar."), store=FileSessionStore("./data/sessions"), ) result = await agent.run(user="demo-user", message="Put the dentist on Thursday at 3pm") print(result.answer, [p.public() for p in result.pending_confirmations]) asyncio.run(main()) ``` `agent.run` returns the answer and the pending confirmations. Every action the agent takes is recorded. ## The five parts - **Long jobs.** Off by default. Turn on `long_task` to give the loop a bigger budget and a folder to work in. See [long-jobs](/docs/agent-harness/long-jobs). - **Permissions.** Each kind of action has one of three modes: Act without asking, Ask the user first, or Never allowed. The strictest overlapping setting wins. See [permissions](/docs/agent-harness/permissions). - **Manual actions.** Steps a person must do outside Harny. The agent hands off the step, and you mark it complete. See [manual-actions](/docs/agent-harness/manual-actions). - **Learning.** Harny may offer to change an action kind's setting, based on recorded responses. You apply it or keep the current setting. See [learning](/docs/agent-harness/learning). - **Connected accounts.** A person approves a link to connect their own account. Harny reads only that person's account. See [connected-accounts](/docs/agent-harness/connected-accounts). For memory writes and reads, see the [Memory API](/docs/memory-api/overview). ## Next - [Quickstart](/docs/agent-harness/quickstart) - [Limits](/docs/agent-harness/limits) - [Memory API](/docs/memory-api/overview)