Blog

How to build an agent in Claude: the no-code way, the Agent SDK way, and the Managed Agents way

You can build a working Claude agent this afternoon, with or without code. Here are the three real paths Anthropic supports, step by step, and an honest guide to which one your idea needs.

Editorial policy

Somewhere in the last few weeks, "how to build an agent in Claude" went from a developer question to a normal-person question. Google Trends showed a one-day breakout of more than 138,000% in the US. If that's you, here's the good news: you don't need to be an engineer, and if you are one, you have better options than writing an agent loop from scratch.

There are three real paths, and they suit different people:

Path Who it's for Code? Where it runs
1. Claude app: skill + connectors + scheduled task Anyone with a paid Claude plan No Claude's cloud
2. Claude Agent SDK Developers embedding an agent in their app, scripts or CI Yes (Python/TypeScript) Your machine or server
3. Claude Managed Agents Teams shipping a production agent Yes (API) Anthropic-managed or self-hosted sandbox

Before any of them: write down, in one sentence, the job your agent does and how you'll know it did it well. "Every Monday, summarize last week's support tickets into five themes with counts" is an agent. "Help with marketing" isn't. Our explainer on how AI agents work shows why that clarity matters more than the tooling.

Path 1: Build a Claude agent with no code

This uses three features in the Claude app: skills, connectors and scheduled tasks.

Step 1. Write the skill. A skill is a folder with a SKILL.md file: a name, a one-line description of when to use it, and the instructions. Anthropic's help center walks through it (how to create custom skills). A good skill reads like a checklist you'd give a new colleague:

---
name: weekly-ticket-themes
description: Summarize last week's support tickets into themes with counts. Use for the Monday support report.
---
1. Pull all tickets created Monday–Sunday of last week.
2. Group them into at most five themes. Name each theme in plain words.
3. For each theme: count, two example ticket titles, and one suggested fix.
4. Flag any ticket mentioning "refund" and over $200 separately.
5. Output a one-page doc. No theme may be "Other" if it holds more than 10%.

Step 2. Upload it. Zip the folder and add it under Customize → Skills, then switch it on.

Step 3. Connect the tools. Under Customize → Connectors, connect only what the job needs: your help desk, Google Drive, whatever the skill reads from or writes to. Fewer connectors means fewer ways to go wrong.

Step 4. Schedule it. Create a scheduled task with the prompt, the cadence and an approval mode (scheduled tasks help). Start with manual approval. Watch three or four runs, fix the skill where it stumbles, then let it run on its own.

That's a real agent: a goal, tools, instructions and autonomy within limits. And since Anthropic merged Cowork into everyday Claude, it can keep working in the cloud while your laptop is closed (Cowork vs Claude Code explains the change).

Path 2: Build an agent with the Claude Agent SDK

The Claude Agent SDK gives you the same agent loop that powers Claude Code, as a library. You bring the task, tools and permissions; it handles the planning, tool calls and context management (Agent SDK quickstart).

pip install claude-agent-sdk
export ANTHROPIC_API_KEY="your-key"
import asyncio
from claude_agent_sdk import query, ClaudeAgentOptions

async def main():
    options = ClaudeAgentOptions(
        system_prompt="You triage failing tests. Explain the root cause before changing code.",
        allowed_tools=["Read", "Grep", "Bash"],
        permission_mode="default",
        max_turns=20,
        cwd="./my-repo",
    )
    async for message in query(prompt="Find why test_checkout fails and propose a fix", options=options):
        print(message)

asyncio.run(main())

The options that matter most, from the Python reference:

  • allowed_tools: the smallest set that does the job. An agent that only reads can't break anything.
  • permission_mode: start strict. Loosen only after you've watched it work.
  • max_turns: a hard ceiling so a confused agent can't loop all night on your bill.
  • cwd: which folder it can see.

Add your own tools as MCP servers when the built-ins aren't enough; our MCP config generator writes the JSON for you.

Path 3: Build with Claude Managed Agents

Claude Managed Agents is the hosted version: Anthropic runs the agent loop, the sandbox and the session state. You define four things (Managed Agents quickstart):

Concept What it is
Agent Model, system prompt, tools, MCP servers and skills, versioned
Environment Where sessions run: Anthropic's cloud sandbox or your own
Session One running instance of the agent doing one task
Events User turns, tool results and status updates streamed between you and the agent

The shape of the code, condensed from Anthropic's quickstart:

from anthropic import Anthropic
client = Anthropic()

agent = client.beta.agents.create(
    name="Coding Assistant",
    model="claude-opus-5-5",
    system="You are a helpful coding assistant. Write clean, well-documented code.",
    tools=[{"type": "agent_toolset_20260401",
            "configs": [{"name": "web_search", "enabled": False},
                        {"name": "web_fetch", "enabled": False}]}],
)
environment = client.beta.environments.create(
    name="quickstart-env",
    config={"type": "cloud", "networking": {"type": "limited", "allow_package_managers": True}},
)
session = client.beta.sessions.create(agent=agent.id, environment_id=environment.id)

with client.beta.sessions.events.stream(session.id) as stream:
    client.beta.sessions.events.send(session.id, events=[{
        "type": "user.message",
        "content": [{"type": "text", "text": "Write fibonacci.py that saves the first 20 numbers to fibonacci.txt"}],
    }])
    for event in stream:
        if event.type == "session.status_idle":
            break

Two details from the docs worth copying. First, open the event stream before sending the first message, or you'll miss events. Second, the example turns off web search and web fetch because the task doesn't need them: give an agent only the tools it needs. With limited networking, an empty allowed_hosts list means web tools return nothing, so add hosts deliberately.

Managed Agents also supports scheduled deployments on a cron schedule, and Anthropic publishes starter apps that pair it with Vercel's Chat SDK, assistant-ui and CopilotKit. If you need the sandbox inside your own cloud, see our guide to self-hosted Claude Managed Agents.

Which path should you choose?

  • You want Monday's report done without you: Path 1. Today.
  • You want an agent inside your product, CI or scripts: Path 2.
  • You're putting an agent in front of customers or running many sessions: Path 3.

Five habits that make any Claude agent work

  1. One job per agent. Split "research and write and publish" into steps or separate agents.
  2. Least privilege. Fewer tools and connectors, read-only where possible.
  3. A human gate on anything irreversible. Money, deletions and outgoing messages should need a yes. See approval gates.
  4. A turn or budget limit. Every path above has one; use it.
  5. Test it like software. Keep ten example inputs and expected outputs, and re-run them when you change the instructions. Our guide to building an eval harness for AI agents shows how.

Want to see what others have built? Browse the AI agents directory, or if your agent will write code, start with Claude Code agent teams and Claude Ship.

FAQ

Can I build an AI agent in Claude without coding?

Yes. In the Claude app, write a skill (a SKILL.md file with a name, description and step-by-step instructions), upload it under Customize > Skills, connect the apps it needs under Customize > Connectors, and set up a scheduled task with the prompt, approval mode and cadence. Start with manual approval and review a few runs before letting it act alone.

What is the Claude Agent SDK?

It is Anthropic's library for building agents on the same agent loop that powers Claude Code. In Python you install claude-agent-sdk, set ANTHROPIC_API_KEY, and call query() with ClaudeAgentOptions such as system_prompt, allowed_tools, permission_mode, max_turns and cwd. It runs where your code runs.

What are Claude Managed Agents?

Claude Managed Agents is an Anthropic API where you define an agent (model, system prompt, tools, MCP servers, skills), an environment (an Anthropic-managed cloud sandbox or your own), and then start sessions that run the agent loop server-side and stream events back. It suits production agents that need sandboxes, schedules and persistent sessions.

Which Claude plan do I need to build an agent?

For the no-code route you need a paid Claude plan with skills, connectors and scheduled tasks (Pro and up). The Agent SDK and Managed Agents use the Claude API and are billed on API usage through a Claude Console account.

Should I use the Agent SDK or Managed Agents?

Use the Agent SDK when the agent runs inside your own app, server or CI and you want full control of the environment. Use Managed Agents when you want Anthropic to host the sandbox, keep the transcript and session state, and run the loop for you, for example behind a chat interface or on a schedule.