> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anchorbrowser.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent

> SDK reference for the Agent resource (TypeScript & Python)

## Upload Agent Resources

`POST /v1/sessions/{sessionId}/agent/files` — uploadAgentFiles

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Agent } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Agent.uploadAgentFiles({
    path: {
      sessionId: 'your-sessionId'
    },
    body: {
      file: new File(['file content'], 'file.txt')
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.agent.upload_agent_files(
      "your-session-id",
      file=("file.txt", b"file content"),
  )
  print(result)
  ```
</CodeGroup>

## List Agent Resources

`GET /v1/sessions/{sessionId}/agent/files` — listAgentFiles

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Agent } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Agent.listAgentFiles({
    path: {
      sessionId: 'your-sessionId'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.agent.list_agent_files(
      "your-session-id",
  )
  print(result)
  ```
</CodeGroup>

## Pause Agent

`POST /v1/sessions/{session_id}/agent/pause` — pauseAgent

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Agent } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Agent.pauseAgent({
    path: {
      session_id: 'your-session-id'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.agent.pause_agent(
      "your-session-id",
  )
  print(result)
  ```
</CodeGroup>

## Resume Agent

`POST /v1/sessions/{session_id}/agent/resume` — resumeAgent

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Agent } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Agent.resumeAgent({
    path: {
      session_id: 'your-session-id'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.agent.resume_agent(
      "your-session-id",
  )
  print(result)
  ```
</CodeGroup>

## List Pending Human Interventions

`GET /v1/sessions/pending-interventions` — listPendingInterventions

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Agent } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Agent.listPendingInterventions();
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.agent.list_pending_interventions()
  print(result)
  ```
</CodeGroup>

## Get Requested Human Interventions

`GET /v1/sessions/{session_id}/agent/requested-human-intervention` — getRequestedHumanIntervention

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Agent } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Agent.getRequestedHumanIntervention({
    path: {
      session_id: 'your-session-id'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.agent.get_requested_human_intervention(
      "your-session-id",
  )
  print(result)
  ```
</CodeGroup>

## Respond to Human Intervention

`POST /v1/sessions/{session_id}/agent/respond-to-human-intervention` — respondToHumanIntervention

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, Agent } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await Agent.respondToHumanIntervention({
    path: {
      session_id: 'your-session-id'
    },
    body: {
      response: 'string'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.agent.respond_to_human_intervention(
      "your-session-id",
      response="string",
  )
  print(result)
  ```
</CodeGroup>
