PromptisePromptise
PlatformSoonEnterprise
DocsGitHub
Talk to usGet started
Promptise - AI Framework LogoPromptise

The full-stack framework for agentic systems. Build with the framework. Run it on the platform. Launch it with our engineers.

pip install promptise

[01] Product

  • Framework
  • Platform (coming soon)
  • Enterprise
  • How it works
  • Contact

[02] Framework

  • The Agent
  • The Interface
  • The Harness

[03] Resources

  • Documentation
  • GitHub
  • Why Promptise
  • Use cases
  • Roadmap
  • Guides
  • Learning Paths
  • Questions

[04] Company

  • About
  • Terms of Service
  • Privacy Policy
  • Cookie Policy
  • Subprocessors

© 2026 Promptise by Manser Ventures. All rights reserved.

hello@promptise.com
← Learning paths> Agentic Engineering with Promptise Foundry
Lesson 10 / 100
10%

Claude AI Agent with MCP: Use Anthropic Models in Promptise

Build a Claude AI agent with MCP tools: set the Anthropic key and model id, use effort instead of temperature, add prompt caching, and fix common errors.

Beginner11 minModel Selection and RoutingModel Context Protocol (MCP)
All 100 lessons↓
  1. ✓What Is an AI Agent? Definition, How It Works, Examples
  2. ✓How to Build an AI Agent in Python (2026 Guide)
  3. ✓Build a Personal AI Agent: Memory, Reminders, Chat
  4. ✓What Is an Agent Harness? Parts and How to Build One
  5. ✓System Prompt Best Practices for AI Agents in Python
  6. ✓Best LLM for AI Agents (2026): Picks, Prices, How to Test
  7. ✓AI Agent YAML: Define and Run an Agent From a Config File
  8. ✓Streaming LLM Responses with FastAPI: Tokens and Tool Calls
  9. ✓Best Local LLM for AI Agents: Ollama Models by GPU (2026)
  10. 10Claude AI Agent with MCP: Use Anthropic Models in Promptise
  11. 11Gemini AI Agent with MCP: Use Google Models in Promptise
  12. 12Azure OpenAI Agent with MCP: Use Deployments in Promptise
  13. 13OpenRouter AI Agent with MCP: Many Models in Promptise
  14. 14Ollama AI Agent with MCP: Run Local Models in Promptise
  15. 15LLM Semantic Cache and Model Fallback in Python
  16. 16What Is MCP (Model Context Protocol)? A Developer's Guide
  17. 17What Is Tool Calling? LLM Function Calling Explained
  18. 18MCP Tools vs Resources vs Prompts (With Python Examples)
  19. 19How to Connect MCP Servers to Your AI Agent in Python
  20. 20Build a Production MCP Server in Python (Step by Step)
  21. 21MCP Transports: stdio vs Streamable HTTP vs SSE (Python)
  22. 22MCP 2026-07-28 Migration: Make Your MCP Server Stateless
  23. 23OpenAPI to MCP: Turn Any REST API into an MCP Server
  24. 24MCP Authentication in Python: API Keys, JWT and OAuth
  25. 25Build an Authenticated MCP Server for Your AI Agent (Python)
  26. 26MCP Security Best Practices: A Checklist for MCP Servers
  27. 27Testing MCP Servers in Python: pytest Without a Live Server
  28. 28Too Many MCP Tools? How to Fix LLM Tool Selection in Python
  29. 29Idempotent Tool Calls: Make AI Agent Retries Safe
  30. 30AI Agent Tool Failures: Stop Unsafe Workarounds
  31. 31MCP Server Caching, Timeouts and Circuit Breakers in Python
  32. 32MCP Middleware for Servers: Auth, Logging, Rate Limits
  33. 33MCP vs CLI for AI Agents: Tokens, Security, When to Use Each
  34. 34LangChain vs MCP: Differences and How They Work Together
  35. 35FastMCP Alternatives for Production MCP Servers (2026)
  36. 36AI Agent Audit Logging: Tamper-Evident Logs in Python
  37. 37AI Agent Human in the Loop: Approve Tool Calls in Python
  38. 38AI Agent Prompt Injection: How to Defend Against It
  39. 39Hidden Text Prompt Injection: Sanitize Pages for AI Agents
  40. 40Build a Multi-Agent System in Python (and When Not To)
  41. 41Context Engineering for AI Agents: Context Window Management
  42. 42Context Compaction for AI Agents: Trim vs Summarize
  43. 43How to Deploy an AI Agent with Docker (2026 Guide)
  44. 44LLM Tool Rate Limiting: Per-Client Limits for MCP Servers
  45. 45MCP Long-Running Tasks: Background Jobs in Python
  46. 46MCP Server Monitoring: Prometheus, OpenTelemetry and Logs
  47. 47Best AI Agent Frameworks (2026): Python Options Compared
  48. 48Self-Improving AI Agent: Learn From Tool Failures in Python
  49. 49AI Agent Identity: Authenticate Agents to MCP Servers
  50. 50Code-Action Agents in Python: One Program vs 37 Tool Calls
  51. 51Multi-Tenant AI Agents: Keep Each Customer's Data Apart
  52. 52What Is Agentic RAG? How It Differs from Classic RAG
  53. 53AI Agent Memory in Python: Short-Term and Long-Term
  54. 54Per-User Agent Memory Isolation: Stop Leaks Between Users
  55. 55Agentic RAG in Python: Give Your AI Agent a Search Tool
  56. 56AI Agent Reasoning Patterns in Python: From ReAct to Debate
  57. 57Plan-and-Execute Agents in Python: Beyond the ReAct Loop
  58. 58Self-Modifying AI Agent in Python: Open Mode & Limits
  59. 59CrewAI Alternatives: 7 Options and How to Migrate (2026)
  60. 60Migrate from AutoGen: Agent Framework, AG2 and More
  61. 61What Is an LLM Guardrail? Types, Examples and Limits
  62. 62Best LLM Guardrails Tools (2026): 9 Platforms Compared
  63. 63AI Agent Guardrails in Python: Block Injection, Redact PII
  64. 64NeMo Guardrails vs Guardrails AI: Which to Choose (2026)
  65. 65AI-Based PII Detection and Redaction Tools for LLM Apps
  66. 66Stop Secrets Leaking Into LLM Logs and Traces
  67. 67AI Agent Code Execution Sandbox: Run LLM Code Safely
  68. 68AI Agent Network Egress: Limit Where Agents Can Connect
  69. 69AutoGen Docker Task Isolation: Secure the Code Executor
  70. 70SPIFFE for AI Agents: Workload Identity Without API Keys
  71. 71On-Behalf-Of Auth for AI Agents: Act as Each User
  72. 72AI Agent Production Checklist: What to Check Before Launch
  73. 73Approval Fatigue: Auto-Approve Safe AI Agent Actions
  74. 74What Is Human in the Loop AI? Approvals for AI Agents
  75. 75AI Agent Notifications: Webhook and Slack Alerts in Python
  76. 76AI Agent Observability: Trace Tool Calls, Tokens and Cost
  77. 77Best AI Agent Observability Tools (2026), Compared
  78. 78AI Agent Stuck in a Loop? How to Detect and Stop It
  79. 79How to Run, Debug and Deploy an AI Agent in Python
  80. 80AI Agent Cost Tracking: Tokens and Cost per Run and User
  81. 81How to Evaluate AI Agents: Evals, LLM Judges and pass^k
  82. 82AI Agent Cost Control: Budgets That Stop Runaway Spend
  83. 83How to Test LLM Prompts and AI Agents in Python
  84. 84AI Agent Evals in CI: Run Them on Every Pull Request
  85. 85What Is an Agentic Runtime? AI Agent Runtimes Explained
  86. 86Autonomous AI Agent Runtime: Budgets, Crash Recovery, API
  87. 87Event-Driven AI Agents: Webhook, Cron and File Triggers
  88. 88AI Agent Cron Jobs: Run an Agent on a Schedule
  89. 89AI Agent Webhook Trigger: Run an Agent on HTTP Events
  90. 90AI Agent File Watcher: Process New Files Automatically
  91. 91Custom AI Agent Triggers: Wake an Agent From Any Source
  92. 92AI Agent Event Filters: Skip Runs Before the LLM
  93. 93AI Agent Retries and a Dead Letter Queue for Failed Runs
  94. 94Run Multiple AI Agents: One Runtime, Many Processes
  95. 95AI Agent Manifest: Declare a Long-Running Agent in YAML
  96. 96AI Agent CLI: Start, Stop and Inspect Running Agents
  97. 97AI Agent Monitoring Dashboard in the Terminal
  98. 98Multi-Agent Event Bus: Chain Agents With Events
  99. 99Distributed AI Agents: Run Agents Across Many Machines
  100. 100Pause and Resume an AI Agent: Lifecycle States Explained

Lessons in this path

  1. ✓What Is an AI Agent? Definition, How It Works, Examples
  2. ✓How to Build an AI Agent in Python (2026 Guide)
  3. ✓Build a Personal AI Agent: Memory, Reminders, Chat
  4. ✓What Is an Agent Harness? Parts and How to Build One
  5. ✓System Prompt Best Practices for AI Agents in Python
  6. ✓Best LLM for AI Agents (2026): Picks, Prices, How to Test
  7. ✓AI Agent YAML: Define and Run an Agent From a Config File
  8. ✓Streaming LLM Responses with FastAPI: Tokens and Tool Calls
  9. ✓Best Local LLM for AI Agents: Ollama Models by GPU (2026)
  10. 10Claude AI Agent with MCP: Use Anthropic Models in Promptise
  11. 11Gemini AI Agent with MCP: Use Google Models in Promptise
  12. 12Azure OpenAI Agent with MCP: Use Deployments in Promptise
  13. 13OpenRouter AI Agent with MCP: Many Models in Promptise
  14. 14Ollama AI Agent with MCP: Run Local Models in Promptise
  15. 15LLM Semantic Cache and Model Fallback in Python
  16. 16What Is MCP (Model Context Protocol)? A Developer's Guide
  17. 17What Is Tool Calling? LLM Function Calling Explained
  18. 18MCP Tools vs Resources vs Prompts (With Python Examples)
  19. 19How to Connect MCP Servers to Your AI Agent in Python
  20. 20Build a Production MCP Server in Python (Step by Step)
  21. 21MCP Transports: stdio vs Streamable HTTP vs SSE (Python)
  22. 22MCP 2026-07-28 Migration: Make Your MCP Server Stateless
  23. 23OpenAPI to MCP: Turn Any REST API into an MCP Server
  24. 24MCP Authentication in Python: API Keys, JWT and OAuth
  25. 25Build an Authenticated MCP Server for Your AI Agent (Python)
  26. 26MCP Security Best Practices: A Checklist for MCP Servers
  27. 27Testing MCP Servers in Python: pytest Without a Live Server
  28. 28Too Many MCP Tools? How to Fix LLM Tool Selection in Python
  29. 29Idempotent Tool Calls: Make AI Agent Retries Safe
  30. 30AI Agent Tool Failures: Stop Unsafe Workarounds
  31. 31MCP Server Caching, Timeouts and Circuit Breakers in Python
  32. 32MCP Middleware for Servers: Auth, Logging, Rate Limits
  33. 33MCP vs CLI for AI Agents: Tokens, Security, When to Use Each
  34. 34LangChain vs MCP: Differences and How They Work Together
  35. 35FastMCP Alternatives for Production MCP Servers (2026)
  36. 36AI Agent Audit Logging: Tamper-Evident Logs in Python
  37. 37AI Agent Human in the Loop: Approve Tool Calls in Python
  38. 38AI Agent Prompt Injection: How to Defend Against It
  39. 39Hidden Text Prompt Injection: Sanitize Pages for AI Agents
  40. 40Build a Multi-Agent System in Python (and When Not To)
  41. 41Context Engineering for AI Agents: Context Window Management
  42. 42Context Compaction for AI Agents: Trim vs Summarize
  43. 43How to Deploy an AI Agent with Docker (2026 Guide)
  44. 44LLM Tool Rate Limiting: Per-Client Limits for MCP Servers
  45. 45MCP Long-Running Tasks: Background Jobs in Python
  46. 46MCP Server Monitoring: Prometheus, OpenTelemetry and Logs
  47. 47Best AI Agent Frameworks (2026): Python Options Compared
  48. 48Self-Improving AI Agent: Learn From Tool Failures in Python
  49. 49AI Agent Identity: Authenticate Agents to MCP Servers
  50. 50Code-Action Agents in Python: One Program vs 37 Tool Calls
  51. 51Multi-Tenant AI Agents: Keep Each Customer's Data Apart
  52. 52What Is Agentic RAG? How It Differs from Classic RAG
  53. 53AI Agent Memory in Python: Short-Term and Long-Term
  54. 54Per-User Agent Memory Isolation: Stop Leaks Between Users
  55. 55Agentic RAG in Python: Give Your AI Agent a Search Tool
  56. 56AI Agent Reasoning Patterns in Python: From ReAct to Debate
  57. 57Plan-and-Execute Agents in Python: Beyond the ReAct Loop
  58. 58Self-Modifying AI Agent in Python: Open Mode & Limits
  59. 59CrewAI Alternatives: 7 Options and How to Migrate (2026)
  60. 60Migrate from AutoGen: Agent Framework, AG2 and More
  61. 61What Is an LLM Guardrail? Types, Examples and Limits
  62. 62Best LLM Guardrails Tools (2026): 9 Platforms Compared
  63. 63AI Agent Guardrails in Python: Block Injection, Redact PII
  64. 64NeMo Guardrails vs Guardrails AI: Which to Choose (2026)
  65. 65AI-Based PII Detection and Redaction Tools for LLM Apps
  66. 66Stop Secrets Leaking Into LLM Logs and Traces
  67. 67AI Agent Code Execution Sandbox: Run LLM Code Safely
  68. 68AI Agent Network Egress: Limit Where Agents Can Connect
  69. 69AutoGen Docker Task Isolation: Secure the Code Executor
  70. 70SPIFFE for AI Agents: Workload Identity Without API Keys
  71. 71On-Behalf-Of Auth for AI Agents: Act as Each User
  72. 72AI Agent Production Checklist: What to Check Before Launch
  73. 73Approval Fatigue: Auto-Approve Safe AI Agent Actions
  74. 74What Is Human in the Loop AI? Approvals for AI Agents
  75. 75AI Agent Notifications: Webhook and Slack Alerts in Python
  76. 76AI Agent Observability: Trace Tool Calls, Tokens and Cost
  77. 77Best AI Agent Observability Tools (2026), Compared
  78. 78AI Agent Stuck in a Loop? How to Detect and Stop It
  79. 79How to Run, Debug and Deploy an AI Agent in Python
  80. 80AI Agent Cost Tracking: Tokens and Cost per Run and User
  81. 81How to Evaluate AI Agents: Evals, LLM Judges and pass^k
  82. 82AI Agent Cost Control: Budgets That Stop Runaway Spend
  83. 83How to Test LLM Prompts and AI Agents in Python
  84. 84AI Agent Evals in CI: Run Them on Every Pull Request
  85. 85What Is an Agentic Runtime? AI Agent Runtimes Explained
  86. 86Autonomous AI Agent Runtime: Budgets, Crash Recovery, API
  87. 87Event-Driven AI Agents: Webhook, Cron and File Triggers
  88. 88AI Agent Cron Jobs: Run an Agent on a Schedule
  89. 89AI Agent Webhook Trigger: Run an Agent on HTTP Events
  90. 90AI Agent File Watcher: Process New Files Automatically
  91. 91Custom AI Agent Triggers: Wake an Agent From Any Source
  92. 92AI Agent Event Filters: Skip Runs Before the LLM
  93. 93AI Agent Retries and a Dead Letter Queue for Failed Runs
  94. 94Run Multiple AI Agents: One Runtime, Many Processes
  95. 95AI Agent Manifest: Declare a Long-Running Agent in YAML
  96. 96AI Agent CLI: Start, Stop and Inspect Running Agents
  97. 97AI Agent Monitoring Dashboard in the Terminal
  98. 98Multi-Agent Event Bus: Chain Agents With Events
  99. 99Distributed AI Agents: Run Agents Across Many Machines
  100. 100Pause and Resume an AI Agent: Lifecycle States Explained
← Path overview

This guide shows how to build a Claude AI agent with MCP tools: an agent that runs on Anthropic's Claude models and calls tools from a Model Context Protocol server. It is for developers who already know what they want the agent to do and need the Anthropic setup to be right: the key, the model id, the settings that current Claude models accept, and the errors you will see when something is off. You will end with one small file you can point at any MCP server.

[01]

How do you build a Claude AI agent with MCP?

Install promptise, put your Anthropic key in ANTHROPIC_API_KEY, and pass a Claude model to build_agent(), either as the string "anthropic:claude-opus-5-5" or as Model("claude-opus-5-5", provider="anthropic"). Promptise reaches Claude through LangChain's native ChatAnthropic integration, which is part of the core install. Add your MCP servers in servers=. The agent discovers their tools, sends them to Claude as tool definitions, runs the calls Claude asks for, and loops until Claude gives a final answer.

  • Nothing extra to install. langchain-anthropic is a core dependency of Promptise, so pip install promptise is the whole setup.

  • One prefix, two spellings. anthropic: and claude: select the same provider.

  • Don't set temperature on current Claude models. Claude Opus 5.5, Sonnet 5.5, Haiku 5.5 and the Fable models reject sampling parameters at non-default values. Use effort instead.

  • Check before you spend. promptise models check claude:<model> tells you what is missing without calling the model. --ping makes one real call.

  • Claude never talks to your MCP server directly. Promptise is the MCP client. Claude only sees tool definitions and tool results.


[02]

Set up Anthropic

You need Python 3.10 or later, an Anthropic API key from the Claude Console, and Promptise Foundry 1.4.2 or later:

>_Terminal
pip install "promptise>=1.4.2"

Put the key in a .env file next to your script. Promptise loads the nearest .env file automatically (from the working directory up to the project root), and a variable already exported in your shell wins over the file. promptise models env anthropic prints the line to fill in:

Output
# Anthropic Claude — model string example: anthropic:claude-sonnet-5-5
export ANTHROPIC_API_KEY=sk-ant-...
#   ↳ console.anthropic.com → API keys

Then check the configuration. Nothing set yet:

Output
$ promptise models check claude:claude-opus-5-5
claude:claude-opus-5-5 → anthropic:claude-opus-5-5  (Anthropic Claude)
  model part: claude-opus-5-5 — the model name
  route: native integration (core)
  ANTHROPIC_API_KEY: MISSING — console.anthropic.com → API keys
Not usable yet.
  - ANTHROPIC_API_KEY is not set: console.anthropic.com → API keys (e.g. sk-ant-...)
  - put ANTHROPIC_API_KEY in a .env file next to your script (loaded automatically; a variable already exported with a non-empty value wins, an empty one is filled from the file), export it, or pass 
it in code: Model(..., api_key=). See promptise models env anthropic

With the key in place, the same command reports the route and stops before calling anything:

Output
$ promptise models check claude:claude-opus-5-5
claude:claude-opus-5-5 → anthropic:claude-opus-5-5  (Anthropic Claude)
  model part: claude-opus-5-5 — the model name
  route: native integration (core)
  ANTHROPIC_API_KEY: set — console.anthropic.com → API keys
Configuration OK — every required setting is in place; nothing was called. Add --ping to make a real one-token call to the model.

"Configuration OK" means the variable is set, not that the key works. Add --ping for a one-token call that proves the key and the model id are accepted.

Which model id to use

Use the exact ids from Anthropic's models overview. At the time of writing, the current models include:

Model

Model id

Good for

Claude Opus 5.5

claude-opus-5-5

The default for agents that plan and use many tools

Claude Fable 5.1

claude-fable-5-1

Demanding reasoning and long-horizon agentic work, at a higher price

Claude Sonnet 5.5

claude-sonnet-5-5

Everyday agent work where speed matters more

Claude Haiku 5.5

claude-haiku-5-5

Routing, classification and high-volume simple steps

Use the ids as written, without date suffixes. Model lists change, so check the overview page before you pin one in production. For choosing between providers, see the best LLM for AI agents.


[03]

Build a minimal Claude AI agent

The agent below answers questions about a shop's products. The model is configured once, at the top of the file, so the rest of the code doesn't depend on the provider:

Pythonclaude_agent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import asyncio
import sys

from promptise import Model, build_agent
from promptise.config import StdioServerSpec

# The key comes from ANTHROPIC_API_KEY (environment or .env).
CLAUDE = Model("claude-opus-5-5", provider="anthropic", max_tokens=16000, extra={"effort": "medium"})


async def make_agent(model=CLAUDE):
    return await build_agent(
        model=model,
        servers={"shop": StdioServerSpec(command=sys.executable, args=["shop_server.py"])},
        instructions="You answer questions about the shop's products. "
                     "Use the tools for stock and prices. Never guess them.",
        max_agent_iterations=10,
    )


async def main():
    agent = await make_agent()
    try:
        result = await agent.ainvoke(
            {"messages": [{"role": "user", "content": "Is KB-101 in stock, and what does it cost?"}]}
        )
        calls = [c["name"] for m in result["messages"] for c in getattr(m, "tool_calls", None) or []]
        print("tool calls:", ", ".join(calls) or "none")
        print(result["messages"][-1].text)
    finally:
        await agent.shutdown()


if __name__ == "__main__":
    asyncio.run(main())

What each part does:

  • Model("claude-opus-5-5", provider="anthropic", ...) names the model and the provider. The key isn't in the code: it comes from ANTHROPIC_API_KEY. You can pass api_key= instead when the key comes from a secret store.

  • max_tokens=16000 caps each response. Without it, LangChain uses the model's maximum output length, which is far more than an agent turn needs.

  • extra={"effort": "medium"} is passed straight through to ChatAnthropic, which sends it as output_config.effort. Effort is how you trade thoroughness against tokens on current Claude models. low suits simple lookups, and high suits multi-step planning.

  • max_agent_iterations=10 stops a run that keeps calling tools without converging.

  • result["messages"][-1].text reads the answer. Claude's replies can contain several content blocks (thinking and text), so .text is safer than .content, which may be a list.

Run it with python claude_agent.py. With a valid key, the script prints the names of the tools Claude called and then its answer.


[04]

Use MCP tools with Claude

The tools come from a small MCP server that the agent starts as a subprocess over stdio:

Pythonshop_server.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""A small MCP tool server: product stock and prices for a shop."""
from promptise.mcp.server import MCPServer

server = MCPServer("shop")

STOCK = {"KB-101": 14, "MS-220": 0, "HD-350": 3}
PRICES = {"KB-101": 89.00, "MS-220": 39.50, "HD-350": 129.00}


@server.tool()
async def check_stock(sku: str) -> dict:
    """How many units of a product (by SKU) are in stock."""
    if sku not in STOCK:
        return {"sku": sku, "error": "unknown SKU"}
    return {"sku": sku, "in_stock": STOCK[sku]}


@server.tool()
async def get_price(sku: str) -> dict:
    """The current price of a product (by SKU), in USD."""
    if sku not in PRICES:
        return {"sku": sku, "error": "unknown SKU"}
    return {"sku": sku, "price_usd": PRICES[sku]}


if __name__ == "__main__":
    server.run()  # stdio by default

Here is what happens on each run:

Your code calls the Promptise agent with ainvoke, and the agent sends tool definitions and messages to Claude. When Claude replies with tool_use for check_stock(KB-101), the agent runs it on shop_server.py over stdio, puts the result into the next Claude call and returns the final answer.
FigureThe Promptise agent sends tools to Claude and runs each tool_use on the MCP server

When the agent is built, Promptise connects to every server in servers=, lists its tools and turns each one into a LangChain tool with the MCP input schema. On every model call, those tools go to Claude as tool definitions. When Claude replies with a tool_use block, Promptise calls the MCP tool, adds the result to the conversation and calls Claude again. Promptise keeps Claude's reply message as returned, thinking blocks included, in the conversation between tool calls, which current Claude models expect.

To use a remote MCP server instead of a local script, replace the stdio spec with HTTPServerSpec(url="https://tools.example.com/mcp", bearer_token="...") from promptise.config. Nothing about the Claude side changes. The MCP connection guide covers transports, authentication and many servers at once.

Anthropic also offers a server-side MCP connector, where the Claude API itself connects to a remote MCP server. It is a different design: the API, not your process, holds the connection, so it only reaches servers that are publicly reachable. With Promptise, tool calls run in your process, so private servers, approval gates and guardrails all work.


[05]

Claude-specific notes

Settings current models accept

Claude Opus 5.5, Sonnet 5.5, Haiku 5.5 and the Fable models reject temperature, top_p and top_k at non-default values. Leave temperature out of Model(...) for these models. Thinking is adaptive and on by default, so you don't need a thinking setting. Control depth and cost with effort (low, medium, high, xhigh, max). On Opus 5.5 the default effort is medium, so set it explicitly if you want something else. Anthropic's models overview lists which settings each model supports.

Tool choice

Promptise binds tools with automatic tool choice: Claude decides whether to call a tool. This matters because the newest Claude models return an error for forced tool choice. Put "use the tools for stock and prices" in the instructions, as the example does, rather than forcing a call.

Prompt caching

An agent resends its system prompt and tool definitions on every turn. Anthropic's prompt caching makes repeated prefixes cheaper. You can turn on automatic caching through the same pass-through:

Python
1
2
3
4
5
6
CLAUDE = Model(
    "claude-opus-5-5",
    provider="anthropic",
    max_tokens=16000,
    extra={"effort": "medium", "cache_control": {"type": "ephemeral"}},
)

ChatAnthropic sends cache_control as a top-level request field, which tells the API to cache up to the last cacheable block. Caching only applies above a minimum prefix length, so a tiny agent like the example may see no cache reads. Check usage_metadata on the reply, or turn on agent observability, to confirm hits.

Limits and pricing

Rate limits depend on your organization's usage tier and are listed on Anthropic's rate limits page. Prices per million input and output tokens are on the pricing page. Prices differ a lot between Opus, Sonnet and Haiku, so put a budget on the agent before you run it on real traffic. The cost control guide shows how.

Claude through a gateway or a cloud provider

The endpoint= word overrides the base URL, for example for a corporate gateway that speaks the Anthropic API. For Claude on Amazon Bedrock, use the bedrock provider with a Bedrock model id instead. Bedrock's prices and limits are set by AWS.

Falling back to another provider

A FallbackChain tries models in order, so an Anthropic outage doesn't take the agent down:

Python
1
2
3
4
5
6
7
from promptise import FallbackChain

model = FallbackChain(
    [CLAUDE, "openai:gpt-5-mini"],
    timeout_per_model=60,
)
agent = await make_agent(model=model)

Keep the instructions provider-neutral if you do this, and test the agent with both models. More patterns are in the semantic cache and fallback guide.


[06]

Common problems and fixes

Symptom

Cause

Fix

ANTHROPIC_API_KEY is not set from promptise models check or build_agent

The key isn't in the environment or in a .env file Promptise can find

Add it to .env next to the script, export it, or pass api_key=

AnthropicAuthenticationError: Error code: 401 ... 'invalid x-api-key'

The key is wrong, revoked or from another organization

Create a new key in the Claude Console and replace it

A ValueError from LangChain saying temperature is not supported at non-default values, or a 400 about sampling parameters from the API

temperature, top_p or top_k set for a model that doesn't accept them

Remove them and use effort

A 400 about tool_choice

A forced tool choice (any or a named tool), for example on a chat model you built yourself and passed in

Use automatic tool choice and steer the model with instructions

A 404 not_found_error for the model

A typo in the id, or an id with a date suffix

Copy the id from the models overview page

429 rate_limit_error

Your usage tier's request or token limit

Back off and retry, lower concurrency, or add a FallbackChain

The agent answers without calling a tool

The instructions don't tell Claude when to use the tools

Say which questions need which tools, and check the tool descriptions on the server

This is the real output of the ping with a key that isn't valid:

Output
$ promptise models check claude:claude-opus-5-5 --ping
Pinging… failed
AnthropicAuthenticationError: Error code: 401 - {'type': 'error', 'error': {'type': 'authentication_error', 'message': 'invalid x-api-key'}, 'request_id': 'req_011Cg9mdnJ3S2ztDcLzirkwK'}
  → the provider rejected the credential — check ANTHROPIC_API_KEY (console.anthropic.com → API keys)

[07]

Frequently asked questions

Do I need the Anthropic Python SDK to build a Claude agent with Promptise?

No separate install is needed. Promptise depends on langchain-anthropic, which depends on the official anthropic SDK, so both are installed with pip install promptise. You don't call the SDK directly: build_agent() builds the ChatAnthropic client from your Model settings and runs the tool loop for you.

Can a Claude agent use MCP servers that run on my own network?

Yes. Promptise is the MCP client, and it runs in your process, so it can reach a stdio server on the same machine or an HTTP server on a private network. Claude receives only the tool definitions and the tool results. This differs from a server-side MCP connector, which needs a server the Claude API can reach over the internet.

Which Claude model should I use for an AI agent?

Start with Claude Opus 5.5 for agents that plan across several tools, and move steps to Sonnet 5.5 or Haiku 5.5 when you can show they hold up on your own tasks. The way to decide is an evaluation on your real tool calls, which the best LLM for AI agents guide walks through.

How do I control how much Claude thinks?

Use effort. Pass it through Model(..., extra={"effort": "low"}), and Promptise forwards it to the Anthropic API as output_config.effort. Lower effort uses fewer tokens and fewer, more consolidated tool calls. Higher effort helps on hard multi-step tasks. Current models choose how much to think on their own within that setting.

Can I switch an existing agent from OpenAI to Claude?

Yes. Change the model string or Model(...) and keep the rest. Remove temperature if you set it, because current Claude models reject it. Then rerun your tests, because two models given the same tools and instructions won't make the same choices.


[08]

Next steps

  • Build the full agent step by step: how to build an AI agent.

  • Write the tool side properly: build a production MCP server.

  • Compare models on your own tasks: best LLM for AI agents.

  • Learn what MCP is and isn't: what is the Model Context Protocol.

  • Every provider setting in one place: Models and providers reference.

← PreviousBest Local LLM for AI Agents: Ollama Models by GPU (2026)Next lesson →Gemini AI Agent with MCP: Use Google Models in Promptise