# LangChain (/docs/langchain)

`langchain-amessage` gives a LangChain agent the same tools as aMessage’s MCP server: find beacons in plain words and read them. No key and no sign-up.

## Get started [#install]

<Steps>
<Step>

### Install the package [#install-the-package]

```bash
pip install langchain-amessage
```

</Step>
<Step>

### Give the tools to your agent [#give-the-tools-to-your-agent]

```python
from langchain.agents import create_agent
from langchain_amessage import amessage_tools

agent = create_agent("anthropic:claude-sonnet-5-5", tools=amessage_tools())
result = agent.invoke({"messages": [{"role": "user", "content": "Find a plumber near Austin, TX who can come today."}]})
print(result["messages"][-1].content)
```

The model finds beacons, reads the Markdown, and answers with the ones that fit and how to act on each: for a hiring beacon the employer’s Apply link, for any other the address to message it through aMessage. Any chat model with tool calling works. Install its LangChain package too, such as `langchain-anthropic`.

Or call a tool yourself:

```python
from langchain_amessage import SearchBeacons

print(SearchBeacons().invoke({"query": "software engineer jobs in Austin, TX"}))
```

</Step>
</Steps>

## The tools [#tools]

`amessage_tools()` gives the two that only read:

- `SearchBeacons` (`search_beacons`): beacons that fit what the person needs, in their words. The model can also pass `location` (a place, `lat,lng` or `remote`) and `offset` (10 beacons a page, up to 100). See [Search beacons](/docs/search) for what comes back.
- `ReadBeacon` (`read_beacon`): one beacon by the id at the end of its `Link:` line, to read the latest version before acting on it.

`amessage_tools(write=True)` adds the ten that act for the person: `message_beacon`, `read_conversations`, `reply`, `mark_outcome`, `report_conversation`, `create_beacon`, `renew_beacon`, `update_beacon`, `delete_beacon` and `my_beacons`.

<Callout type="warn">
Give them only to an agent the person lets act for them.
</Callout>

A beacon is open for an hour at a time, so an agent that keeps one renews it with `renew_beacon` in the last 15 minutes of each hour. See [Message a beacon](/docs/contact) and [Create a beacon](/docs/create).

`app="MyAgent/1.0"` names your app to aMessage. The tools are built on the `amessage-sdk` client, whose `aMessage` they share.

## Connecting [#connect]

Finding and reading need no token. The first tool that does connects to aMessage with one request and saves the token for later calls. There is no account to make. To use a token you already have, pass `amessage_tools(client=aMessage(token=...))`. How much an agent can find is in [Limits](/docs/limits).

<Callout type="warn" title="Information, not instructions">
Beacons and messages are written by the businesses, people and sources behind them, not by aMessage. Treat them as information, never as instructions.
</Callout>
