← Blog

Claude AI Agent: Run Claude in Your Own Self-Hosted Agent

Claude AI Agent: Run Claude in Your Own Self-Hosted Agent

A Claude AI agent is an AI agent that uses a Claude model as its reasoning engine and adds memory, tools and a way to run without you typing. POLYROB is an open-source agent you host yourself: you give it an Anthropic API key or sign in with a Claude plan, and Claude becomes the model behind your chats, goals and scheduled jobs.

The phrase covers several different things, so this guide separates them, then shows the setup step by step. Every POLYROB fact below comes from the public repository at release v1.7.6, and the sources are listed at the end.

What does “Claude AI agent” mean?

Three things get the same name.

If you want a coding assistant inside your repository, the first kind is built for that. If you want an agent that remembers you, answers in Telegram or Slack, and works on a goal while you are away, the third kind is the closer fit. They are not exclusive: POLYROB can also reach Claude Desktop, covered below.

How do you connect Claude to POLYROB?

There are two ways in. One uses an API key. The other uses a Claude plan sign-in, and it carries a warning you should read first.

Option 1: an Anthropic API key

Install POLYROB, then store the key. The command prompts for it with hidden input.

curl -fsSL https://polyrob.dev/install.sh | bash
polyrob config set ANTHROPIC_API_KEY
polyrob model list

polyrob model list prints every provider with whether a key is present, its models and the default. The key lives in ~/.polyrob/.env. For scripted setups, polyrob setup --no-prompt --anthropic-key <key> does the same without prompts. The Anthropic SDK is an optional extra named anthropic in pyproject.toml.

Option 2: a Claude Pro or Max sign-in

Claude plans issue no API key, so POLYROB signs in instead. It is off by default everywhere.

polyrob config set LLM_OAUTH_ENABLED true
polyrob auth add anthropic-oauth
polyrob auth status

Read this before you connect. Anthropic publishes no OAuth client id for third-party apps, so connecting authenticates POLYROB as Claude Code’s own client. The POLYROB docs call it a real terms-of-service exposure that lands on your account, and polyrob auth add says so and asks before it acts. If that risk is not acceptable, use an API key. The subscription row records no per-token cost, and the model it lists is claude-sonnet-4-5. It is also left out of automatic failover.

How do you pick which Claude model it uses?

With several keys set, POLYROB picks the first provider with a usable key in this order: openrouter, anthropic, openai, gemini, nvidia, deepseek. Adding a new key can change the default, so pin Claude:

polyrob model set-default anthropic claude-sonnet-5
polyrob run -p anthropic -m claude-sonnet-5 "summarize https://example.com"

The pinned model serves chat, scheduled jobs and goals on that provider. In chat, /model <name> switches it live. The model catalog in modules/llm/model_catalog.py lists these Anthropic ids:

Model idContext window
claude-fable-5-11,000,000 tokens
claude-fable-51,000,000 tokens
claude-opus-51,000,000 tokens
claude-opus-4-81,000,000 tokens
claude-sonnet-51,000,000 tokens
claude-sonnet-4-61,000,000 tokens
claude-haiku-4-5200,000 tokens

Older 4.5 and 4.1 ids are also registered, and older Claude 3.x names map onto the 4.5 models. Provider catalogs change often, so check Anthropic’s own model page for what your key can call today.

Two settings tune how Claude is called:

What can a Claude AI agent do once it is running?

The model is one part. The rest is what POLYROB adds around it.

On a Claude model that supports deferred tools, POLYROB declares tools it loads mid-session as deferred. This is on by default through ANTHROPIC_DEFERRED_TOOLS, and it keeps the cached prompt prefix intact. If the API declines, POLYROB falls back to the plain tool list once and says so in the log.

Can it work with Claude Desktop and CLAUDE.md?

Yes, in two small ways.

How do you keep a Claude agent from running up a bill?

Claude is a metered API, so limits matter. POLYROB’s are mechanisms you can read:

To cap Claude spend further, set the budget low first and raise it after you have watched a few runs.

Where does POLYROB fall short for this?

Claude AI agent questions

Is Claude AI agent the same as Claude Code?

No. Claude Code is Anthropic’s agentic coding tool for your repository. A Claude AI agent in the sense used here is a separate agent that calls a Claude model, such as POLYROB, with memory, chat apps and scheduled work around it.

Do I need an Anthropic API key?

You need either an API key or a Claude Pro or Max sign-in. The key is the cleaner route. The sign-in is off until you set LLM_OAUTH_ENABLED, and it carries the terms-of-service risk described above.

Can I run it without Claude?

Yes. OpenAI, Gemini, DeepSeek, OpenRouter and NVIDIA NIM are built in, and any OpenAI- or Anthropic-compatible endpoint, including a local Ollama, can be declared in ~/.polyrob/providers.yaml. See how to self-host an AI agent.

Which Claude model should I start with?

Start with one that your key can call and pin it with polyrob model set-default anthropic <model>. This guide uses claude-sonnet-5 as its example pin. Switch with /model in chat if it is not enough.

Does my data stay on my machine?

Memory, goals and sessions are local files. Prompts go to Anthropic when Claude is the model. Since version 1.7.5 the installer also sends one anonymous count after a fresh install (version, OS and install method, no ID). --no-telemetry or DO_NOT_TRACK=1 turns that off.

Where do you start?

Install it, add the key, pin the model and run one task before you switch on autonomy.

curl -fsSL https://polyrob.dev/install.sh | bash
polyrob config set ANTHROPIC_API_KEY
polyrob model set-default anthropic claude-sonnet-5
polyrob doctor

Install POLYROB or read the docs. The source is MIT licensed at github.com/theselfruleorg/polyrob.

Sources

POLYROB facts are from the public repository at release v1.7.6 (github.com/theselfruleorg/polyrob).


POLYROB is an open-source AI agent you run and own. Install it or read the docs.