4. Operate from Claude Code
So far you have assembled agents by hand in the console, the CLI, and the SDK. On this page, you hand that work to Claude Code. Claude Code ships with the bundled claude-api skill, which carries up-to-date reference material for the Claude API and Managed Agents. Combined with the ant command you set up in 2. Create an Agent with the CLI, you can simply ask “list my agents”, “run a session with this agent”, or “create a new agent”, and Claude Code prepares and runs the necessary commands and files.
1. Preparation
Section titled “1. Preparation”-
Install Claude Code and sign in. If you already use it, you are all set. Run
claude updateto get the latest version so you have the latest skill. -
Make sure
antis set up andant auth loginis done (step 1 of 2. Create an Agent with the CLI). Claude Code reads and writes your workspace’s resources throughant.Terminal window ./ant auth statusTerminal window ant auth status -
Create a working folder, move into it, and start Claude Code.
Terminal window mkdir claude-code-agentscd claude-code-agentsclaude
2. What the claude-api Skill in Claude Code Can Do
Section titled “2. What the claude-api Skill in Claude Code Can Do”The claude-api skill is an Agent Skill bundled with Claude Code. No installation is needed; it activates automatically whenever you ask about the Claude API or Managed Agents. You can also invoke it explicitly by typing /claude-api.
| What it does | How to use it |
|---|---|
| Consults up-to-date reference material | Activates automatically when Managed Agents comes up, so answers and generated code use current model IDs, pricing, and API shapes |
| Creates a new agent through an interview | /claude-api managed-agents-onboard asks what you want to build, then writes configuration files for the agent, environment, and session in that order and applies them with ant apply |
| Builds from a console template | Name a template such as /claude-api managed-agents-onboard deep-researcher. The “Deep researcher” from Beginner 1 can be built this way |
| Reproduces an article or sample from the web | /claude-api managed-agents-onboard <URL> assembles an agent from a docs page or blog post |
| Checks security settings | /claude-api managed-agents-secure <agent id> compares the agent with the official security guide and reports, read-only |
| Operates existing resources | For requests like “list them” or “create a session”, it assembles and runs commands such as ant beta:agents list and ant beta:sessions create |
3. List the Agents You Have Created
Section titled “3. List the Agents You Have Created”-
Ask Claude Code:
List the Managed Agents agents, environments, and sessions in this workspace. Put the IDs and names in a table. -
Claude Code asks for permission to run
antcommands; allow it. Under the hood it runs commands like these:Terminal window ant beta:agents list --transform '{id,name,model}' --format jsonlant beta:environments list --transform '{id,name,config.networking.type}' --format jsonlant beta:sessions list --max-items 10 --transform '{id,status,agent.id}' --format jsonl -
The agents you created on the previous pages (
AZ-900 Quiz Agent,AZ-900 Quiz Agent CLI,AZ-900 Quiz Agent SDK, and so on) come back as a table.
4. Invoke an Existing Agent
Section titled “4. Invoke an Existing Agent”-
Name an agent from the list and ask for a session to be run.
Create a new session with "AZ-900 Quiz Agent CLI" and send "Give me one AZ-900 practice question". When the agent responds, show me the question and the options as they are. -
Claude Code looks up the agent and environment IDs, then creates the session, sends the message, and receives the events. It does in one go what you did by hand with two terminals in 2. Create an Agent with the CLI.
Terminal window SESSION_ID=$(ant beta:sessions create --agent agent_... --environment-id env_... --transform id -r)ant beta:sessions:events send --session-id "$SESSION_ID" --event '{type: user.message, content: [{type: text, text: "Give me one AZ-900 practice question"}]}'ant beta:sessions:events list --session-id "$SESSION_ID" --format jsonl --transform '{type,text:content.0.text}' -
Once the question appears, ask it to send your answer. It goes to the same session, so the question → answer → verdict conversation continues.
Send "C" as my answer to the same session and show me the verdict and explanation. -
When you are done, ask it to stop the session.
Archive this session.
5. Create a New Agent
Section titled “5. Create a New Agent”-
Run the onboarding subcommand.
/claude-api managed-agents-onboard -
It asks what kind of agent you want. Here we build the AWS quiz bot from Beginner 3, Challenge 3.
An agent that fetches up-to-date information from the AWS Knowledge MCP server (https://knowledge-mcp.global.api.aws, no authentication) and asks AWS Certified Cloud Practitioner (CLF-C02) practice questions one at a time. After presenting the question and options, it must not reveal the answer until the user responds. After the answer, it gives the verdict, a one-line explanation per option, and three useful AWS documentation URLs. It remembers the user's answers and focuses on weak areas. Users interact with it by answering questions in chat. -
Claude Code proposes an agent configuration including the model, tools, and MCP server. Review it and approve. If asked whether tools should run without confirmation or whether risky actions should be judged, “run without asking” is fine here because this agent only reads.
agents/aws-quiz-agent/agent.md (example) ---name: AWS Quiz Agentmodel: claude-sonnet-5-5mcp_servers:- name: aws-knowledgetype: urlurl: https://knowledge-mcp.global.api.awstools:- type: agent_toolset_20260401default_config: {permission_policy: {type: auto}}configs:- {name: web_fetch, enabled: false}- {name: web_search, enabled: false}- type: mcp_toolsetmcp_server_name: aws-knowledgedefault_config: {permission_policy: {type: always_allow}}---You are a study assistant that creates AWS Certified Cloud Practitioner (CLF-C02) practice questions using the AWS Knowledge MCP server.... -
Next it asks about the environment. Pick an existing one (such as
Quiz-environment-cli) or “Create a new environment”. For a new one it asks about network scope; go with “Limited”. -
For the credential vault, “Skip for now” is fine because the MCP server needs no authentication.
-
Claude Code runs
ant apply --dry-runand shows what will be applied (organization, workspace, resources to be created). If it looks right, approve, andant apply --yescreates the agent and environment and records the IDs inclaude-lock.json. -
Finally it asks “Run a test session?”. Choose “Start session” and Claude Code writes
agents/aws-quiz-agent/session.yaml, creates the session, and sends the first message. Attach your terminal withant beta:sessions connectto follow the exchange.
6. Check the Security Settings (Optional)
Section titled “6. Check the Security Settings (Optional)”You can check whether an agent is configured for production use against the official security guide.
/claude-api managed-agents-secure agent_YOUR_AGENT_IDIt reads the agent’s configuration, recent sessions, environment, and vault, and reports which settings to change and the recommended values. It is read-only, so nothing is modified.
Summary
Section titled “Summary”- The
claude-apiskill in Claude Code provides up-to-date Managed Agents reference material, an interactive agent-creation flow (managed-agents-onboard), and a security check (managed-agents-secure). - Everyday operations such as listing, creating sessions, and sending messages are as simple as asking in plain language; Claude Code assembles and runs the
antcommands, which are the same ones you typed by hand in 2. Create an Agent with the CLI. - The recommended flow is to manage agents and environments as files under
agents/withant apply. The IDs are recorded inclaude-lock.json, and your application code (SDK) creates sessions from those IDs.
Great work! Please share your thoughts so far in a post on X.
Share your thoughts on X