Skip to main content

Your First Agent

After running cast init, you have a working agent. Let’s understand its structure and how to customize it.

Agent Structure

Every Castari agent has this structure:

castari.json

The agent configuration file:

CLAUDE.md

This file contains instructions for Claude. It’s like a system prompt that shapes your agent’s behavior:
The better your CLAUDE.md, the better your agent performs. Be specific about capabilities, constraints, and expected behavior.

src/index.ts

The entry point defines your agent’s tools and handles invocations:

Local Testing

Test your agent locally before deploying:
This runs your agent with the prompt as input, just like cast invoke does remotely.

Customizing Your Agent

Add a New Tool

  1. Define the tool schema in tools array
  2. Add the handler in handleTool function

Change Agent Behavior

Edit CLAUDE.md to change how your agent thinks and acts:

Add Dependencies

Then import and use in your agent:

Redeploying

After making changes, redeploy:
This uploads your changes and creates a fresh sandbox.
Redeploying destroys the previous sandbox. Any files or state in the sandbox are lost.

Next Steps

CLI Reference

Learn all available commands

Templates

Try different agent templates

Add Secrets

Add API keys for external services

How It Works

Understand the architecture