<!-- Generated by scripts/gen-docs.ts from the TSDoc in src/. Do not edit by hand. -->

# `run`

Source: [`src/run.ts`](https://github.com/AI-for-dev/combo/blob/main/src/run.ts)

`run()`: the disposable form. Spawn, ask, close.

This is the only place where the lifetime is implicit - precisely because it
is entirely contained within the call. Nothing survives the return.

## `run`

*function*

```typescript
export async function run(agent: Agent, task: string, options: RunOptions = {}): Promise<Result> { /* … */ }
```

Runs one task with a throwaway subagent.

The lifetime is forced to `"task"`: an agent whose frontmatter declares
`lifetime: workflow` gains nothing from persisting across a single turn.
Use {@link spawn} when the memory must outlive the call.

The session is closed even if the turn fails or is cancelled.

## `RunOptions`

*type*

```typescript
export type RunOptions = Omit<SpawnOptions, "lifetime"> &
	AskOptions & {
		/** Defaults to the real {@link spawn}, like every combinator's. */
		spawn?: SpawnFn;
	};
```

{@link SpawnOptions} without `lifetime` - `run` is `"task"` by definition - plus the per-turn deadline.
