---
url: https://bishop.agentdeployment.co/how-it-works.md
description: The pieces of Bishop, what happens during a turn, and what it keeps on disk.
---

# How It Works

Bishop is an agent gateway: one process that runs one agent and connects it to the places people already talk.

## The pieces

* **Agent.** A directory with an agent in it, run by a harness. Bishop doesn't decide what the agent does or knows. Its own configuration does, like `CLAUDE.md` and `.claude/settings.json`.
* **Harness.** The software that runs the agent: Claude Code through the Claude Agent SDK, or Codex through OpenAI's Codex SDK. One Bishop runs one of them. See [Harness and Model](/running/harness).
* **Interface.** A place people talk to the agent from: [Slack](/interfaces/slack), [email](/interfaces/email) or [Microsoft Teams](/interfaces/teams). Bishop runs every interface whose credentials are present, in the same process.
* **Thread.** One conversation: a Slack thread or DM, an email thread, a Teams chat or channel thread.
* **Turn.** One exchange inside a thread. Messages arrive, the agent works, and an answer goes back.
* **Session.** The agent's memory of a thread. Bishop records which session belongs to which thread, and hands it back on the next message so the conversation picks up where it left off, including after a restart.
* **Schedule.** A prompt that runs on a clock instead of on a message. See [Scheduled Prompts](/running/schedules).

## A turn

1. A message arrives on an interface. Bishop checks the sender against that interface's [allow list](/running/access), and refuses the message if they're not on it.
2. Bishop finds the thread's session, or starts one, and hands the agent the message along with who sent it and where the conversation is.
3. The agent works in its directory, or in the thread's own [worktree](/running/worktrees). Slack and Teams show the work as it happens. Email sends one reply when the turn is over.
4. Files people attached reach the agent as paths on disk, and files the agent sends go back as attachments. See [Files](/running/files).

Two threads are two independent conversations, even with the same person.

## What Bishop keeps

Everything is in Bishop's own directory, the one you run it from:

```
.bishop/config.json    configuration
.env                   credentials
bishop.db              threads, sessions, schedules
.bishop/files/         files people shared, one directory per thread
.bishop/agents/        agents cloned from a git URL
.bishop/backups/       database copies taken before a migration
```

The harnesses keep their own session transcripts under the home directory of the user Bishop runs as, and a thread can't resume without them. Bishop [collects](/deploying/cleanup) what old threads leave behind.

## What Bishop serves

Slack and Gmail need outbound access only: Slack holds a socket open and Gmail polls. Teams POSTs every message to an HTTPS endpoint, so Bishop serves one when Teams credentials are present. Bishop also serves the agent its own tools, like scheduling a prompt and sending a file, on a loopback port with a credential that lasts one turn. Every port binds loopback. Nothing is reachable from off the machine unless you put a tunnel in front of it.
