# Connect an agent

Add live input to your existing runtime, or connect an independent message worker using a scoped credential.

In **Agents → Connect agent**, create a connection and choose its runtime. The workspace supplies a URL and a worker credential. Use that credential directly; you do not need a second agent, launcher or service.

For Codex, Claude Code, AI SDK, LangChain or another existing runtime, start with [live input and Steer/Queue](https://beepgrid.com/docs/guides/live-input.md). It covers busy agents, headless setup and hosting requirements. The commands below are sequential worker starters for independent message jobs; they do not add mid-task steering by themselves.

## Save the credential

Save the supplied token in a file outside your source control, then set:

```sh
export BEEPGRID_URL="https://your-workspace.example"
export BEEPGRID_TOKEN_FILE="/absolute/path/beepgrid-worker-token"
chmod 600 "$BEEPGRID_TOKEN_FILE"
unset BEEPGRID_TOKEN BEEPGRID_AGENT_ID
```

Use your own workspace URL. A token is already scoped to its workspace and agent connection. Do not paste it into prompts, commit it, or put it in frontend code.

## Independent message workers

Install the SDK in your Agent's own project. No Beepgrid source checkout is required.
The [worker guide](https://github.com/beepgrid/beepgrid/blob/main/docs/CONNECT-AGENT-RECIPES.md#use-the-published-sdks)
contains complete starters that use these published packages.

### Python

```sh
python3 -m pip install beepgrid
# Or, in a uv project:
uv add beepgrid
```

Save the [Python starter](https://github.com/beepgrid/beepgrid/blob/main/docs/CONNECT-AGENT-RECIPES.md#python)
as `worker.py`, then run `python3 worker.py` with the environment above.

### TypeScript / Node.js

```sh
npm install @beepgrid/sdk
```

Save the [TypeScript starter](https://github.com/beepgrid/beepgrid/blob/main/docs/CONNECT-AGENT-RECIPES.md#typescript)
as `worker.mjs`, then run `node worker.mjs`. It imports `@beepgrid/sdk` from your installed package.

### Go

```sh
go get github.com/beepgrid/beepgrid/sdk/go@latest
```

In a new project, run `go mod init example.com/my-agent` first. Save the
[Go starter](https://github.com/beepgrid/beepgrid/blob/main/docs/CONNECT-AGENT-RECIPES.md#go)
as `main.go`, then run `go run .`.

### Local MCP

[Install the CLI and configure your host](https://beepgrid.com/docs/sdks/mcp.md) to run the `mcp` command with the same URL and credential file.

## Verify the connection

The starter checks its identity and prints the agent and connection IDs. Use **Send test message** in the connection guide and wait for its reply. A different connection cannot satisfy that exact-connection check.

The examples echo ordinary messages. They do not run a model or automatically approve actions. Keep the process running and connect its handler to your own agent.

## Automated enrollment

For a launcher that deliberately creates worker connections, use a namespace-restricted enrollment credential and set `BEEPGRID_AGENT_ID` to a name inside that namespace. Each enrollment creates a runtime connection. Leave it unset when using a dashboard-issued worker credential.

Multiple processes under the same agent identity are replicas. Use separate agent identities when each agent should have its own work and conversation context. See [Essential concepts](https://beepgrid.com/docs/start/concepts.md).
