> **Start here for agents.** No account is needed. The full steps, in order, are in https://harny.ai/auth.md. The index of every page is https://harny.ai/llms.txt. > Never print, commit or ask for an app key. Provision the app once and reuse its key. Do not provision on every run. Keys are server-side secrets. Never put one in browser or mobile code. > Write no API call from memory. Read the machine-readable description at https://harny.ai/openapi.json. > Every refusal uses a JSON body with code, status, debugMessage and data. Codes and what each means: https://harny.ai/docs/memory-api/errors.md # Agent harness quickstart > Run your own agent loop with Harny in a few lines of Python, on your own model key. ## Install Install the SDK. It needs Python 3.10 or newer. ```bash pip install harny ``` ## Run a first agent Save this as a script. Use your app key, which starts with `fsa_`. In real code, read it from your environment, for example from `HARNY_APP_KEY`, instead of writing it in the file. ```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, provider="your-provider", # the provider you chose model="your-model-id", # the model you chose 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()) ``` The loop runs in your code. You choose the provider and the model. Harny names none. See [Models and keys](/docs/agent-harness/models). ## Model key Harny never sees your model key. Put it in the provider's conventional variable, for example `ANTHROPIC_API_KEY`. The SDK reads it from there. You can also pass it as `api_key=` in code. Name your model with `provider=` and `model=`, or with the variables `HARNY_MODEL_PROVIDER` and `HARNY_MODEL`. ## What the result holds `agent.run` returns a result with these fields: - `run_id`: the id of this run. - `answer`: the reply text for the person. - `stopped_reason`: one of `completed`, `cut_off`, `max_steps`, `spend_cap`, `timeout`, `model_error`, or `blocked`. - `steps` and `actions`: what the agent did during the run. - `pending_confirmations`: actions that wait for a yes. - `usage`, `cost_usd`, `model`, and `trace_id`. ## Default limits A run uses these defaults: - `actions`: `("calendar.create_event",)` - `allow_undo`: `True` - `max_steps`: 6 - `run_timeout_s`: 90 - spend cap: 100,000 tokens ## Confirm a pending action An action that needs a yes comes back in `pending_confirmations`. Each item is a pending confirmation. Your code approves or refuses it. The model cannot do this. ```python await agent.confirm(pending, approve=True) # or approve=False to refuse ``` Which actions wait for a yes depends on the permission settings of your app. See [Permissions](/docs/agent-harness/permissions). ## Where runs show up Set `record_runs=True` to send a short summary of each run after it ends. The summary holds the step kind, tool name, outcome, duration, and token counts. It never holds the person's message or the answer text. A failed send does not change the run. Every action is also recorded. Harny records each one with `POST /v1/actions`, and you can list and export the records. ## Next - [Agent harness overview](/docs/agent-harness/overview) - [Permissions](/docs/agent-harness/permissions) - [Long jobs](/docs/agent-harness/long-jobs)