# Agentuity Documentation > The full-stack platform for AI agents. Agentuity is a cloud platform for building, deploying, and operating AI agents. The TypeScript SDK provides a Bun-native runtime, schema validation, and React hooks. Use the `agentuity` CLI for local development and deployment. ## Built-in services Services include, but are not limited to: - **Routes and APIs**: type-safe Hono routes with auth, rate limiting, SSE, and WebSockets - **Frontend**: end-to-end type safety from agent schemas to React hooks - **Data and storage**: Postgres, key-value, vector, object storage, and durable streams - **Sandboxes**: isolated runtimes for untrusted or generated code - **Messaging and scheduling**: queues, webhooks, email, and cron-style schedules - **Authentication**: sessions, API keys, bearer tokens, and OAuth apps - **AI Gateway**: LLM provider routing with usage and cost visibility - **Observability**: OpenTelemetry traces, structured logs, and session analytics - **Agent-to-agent communication**: type-safe calls between agents with context propagation ## Notes - This covers the Agentuity platform. General AI agent concepts may require outside sources. - Bun is the supported runtime, so examples assume TypeScript and Bun. - LLM requests route through the Agentuity AI Gateway by default, so no separate provider API keys are required. ## Get Started - [Get Started](https://agentuity.dev/get-started.md): Start building AI agents with Agentuity - [What is Agentuity?](https://agentuity.dev/get-started/what-is-agentuity.md): The full-stack platform for building, deploying, and operating AI agents - [Installation](https://agentuity.dev/get-started/installation.md): Set up your development environment - [Quickstart](https://agentuity.dev/get-started/quickstart.md): Build your first agent in 5 minutes - [Project Structure](https://agentuity.dev/get-started/project-structure.md): Understand how Agentuity projects are organized - [App Configuration](https://agentuity.dev/get-started/app-configuration.md): Configure your Agentuity project ## Agents - [Agents](https://agentuity.dev/agents.md): Build and configure AI agents - [When to Use Agents vs Routes](https://agentuity.dev/agents/when-to-use.md): When to create an agent vs handling requests directly in routes - [Creating Agents](https://agentuity.dev/agents/creating-agents.md): Build agents with createAgent(), schemas, and handlers - [Schema Libraries](https://agentuity.dev/agents/schema-libraries.md): Choose from built-in, Zod, Valibot, or ArkType for validation - [Using the AI Gateway](https://agentuity.dev/agents/ai-gateway.md): Automatic LLM routing with observability and cost tracking - [Using the AI SDK](https://agentuity.dev/agents/ai-sdk-integration.md): Generate text, structured data, and streams with the Vercel AI SDK - [Returning Streaming Responses](https://agentuity.dev/agents/streaming-responses.md): Return real-time LLM output with streaming agents - [Managing State](https://agentuity.dev/agents/state-management.md): Request and thread state for stateful agents - [Calling Other Agents](https://agentuity.dev/agents/calling-other-agents.md): Build multi-agent systems with type-safe agent-to-agent communication - [Running Agents Without HTTP](https://agentuity.dev/agents/standalone-execution.md): Execute agents programmatically for cron jobs, bots, CLI tools, and background workers - [Events & Lifecycle](https://agentuity.dev/agents/events-lifecycle.md): Lifecycle hooks for monitoring and extending agent behavior ## Routes - [Routes](https://agentuity.dev/routes.md): Define HTTP endpoints, triggers, and real-time connections - [Creating HTTP Routes](https://agentuity.dev/routes/http.md): Define GET, POST, and other HTTP endpoints with Hono - [Middleware & Authentication](https://agentuity.dev/routes/middleware.md): Add authentication, validation, and request processing to your routes - [Calling Agents from Routes](https://agentuity.dev/routes/calling-agents.md): Import and invoke agents from your routes - [Scheduling Cron Jobs](https://agentuity.dev/routes/cron.md): Run tasks on a schedule with the cron() middleware - [Using WebSockets](https://agentuity.dev/routes/websockets.md): Real-time bidirectional communication with the websocket middleware - [Streaming with SSE](https://agentuity.dev/routes/sse.md): Stream updates from server to client using SSE middleware - [Using WebRTC](https://agentuity.dev/routes/webrtc.md): Peer-to-peer audio, video, and data channels with the webrtc middleware - [Using Explicit Routing](https://agentuity.dev/routes/explicit-routing.md): Pass your own Hono router to createApp() when you need custom mount paths or an exported router type ## Frontend - [Frontend](https://agentuity.dev/frontend.md): Build React frontends that connect to your agents - [React Hooks](https://agentuity.dev/frontend/react-hooks.md): Provider, auth, analytics, and WebRTC hooks from @agentuity/react - [RPC Client](https://agentuity.dev/frontend/rpc-client.md): Type-safe API calls from any JavaScript environment using hc() from hono/client - [Provider Setup](https://agentuity.dev/frontend/provider-setup.md): Legacy AgentuityProvider setup for @agentuity/react apps - [Adding Authentication](https://agentuity.dev/frontend/authentication.md): Add user authentication with Agentuity Auth - [Deployment Scenarios](https://agentuity.dev/frontend/deployment-scenarios.md): Deploy your frontend alongside agents or separately on Vercel, Netlify, etc. - [Static Rendering](https://agentuity.dev/frontend/static-rendering.md): Pre-render your frontend to static HTML for faster page loads and better SEO - [Advanced Hooks](https://agentuity.dev/frontend/advanced-hooks.md): Advanced WebRTC callbacks plus low-level WebSocket and SSE client utilities ## Services - [Services](https://agentuity.dev/services.md): Storage, messaging, observability, and infrastructure services - [Queues](https://agentuity.dev/services/queues.md): Publish messages for async processing, webhooks, and event-driven workflows - [Email](https://agentuity.dev/services/email.md): Send and receive emails with managed addresses, destinations, and delivery tracking - [Webhooks](https://agentuity.dev/services/webhooks.md): Create webhook endpoints to receive HTTP callbacks with delivery tracking and retry - [Schedules](https://agentuity.dev/services/schedules.md): Create platform-managed cron jobs with HTTP and sandbox destinations - [Tasks](https://agentuity.dev/services/tasks.md): Track work items, issues, and agent activity with built-in lifecycle management - [Choosing Authentication](https://agentuity.dev/services/authentication.md): Choose between Sign in with Agentuity and app-owned authentication for routes and apps - [Sign in with Agentuity](https://agentuity.dev/services/oidc-provider.md): Add Agentuity account sign-in and scoped access to your app with OAuth 2.0 and OIDC - [Coder](https://agentuity.dev/services/coder.md): Manage AI coding sessions that run in cloud sandboxes with full lifecycle, replay, and reconnect support ### Database - [Database](https://agentuity.dev/services/database.md): Relational database storage using Bun's native SQL APIs - [Resilient Postgres Client](https://agentuity.dev/services/database/postgres.md): Auto-reconnecting PostgreSQL client for serverless environments - [Drizzle ORM](https://agentuity.dev/services/database/drizzle.md): Type-safe database access with Drizzle ORM ### Storage - [Storage](https://agentuity.dev/services/storage.md): Persistent storage options for agents and routes - [Key-Value Storage](https://agentuity.dev/services/storage/key-value.md): Fast, ephemeral storage for caching, session data, and configuration - [Vector Storage](https://agentuity.dev/services/storage/vector.md): Semantic search and retrieval for knowledge bases and RAG systems - [Object Storage (S3)](https://agentuity.dev/services/storage/object.md): Durable file storage using Bun's native S3 APIs - [Durable Streams](https://agentuity.dev/services/storage/durable-streams.md): Streaming storage for large exports, audit logs, and real-time data - [Custom Storage](https://agentuity.dev/services/storage/custom.md): Local development storage and bringing your own storage implementations ### Observability - [Observability](https://agentuity.dev/services/observability.md): Logging, tracing, and debugging for agents - [Logging](https://agentuity.dev/services/observability/logging.md): Structured logging for agents and routes - [Tracing](https://agentuity.dev/services/observability/tracing.md): OpenTelemetry spans for performance debugging and operation tracking - [Sessions & Debugging](https://agentuity.dev/services/observability/sessions-debugging.md): Debug agents using session IDs, CLI commands, and trace timelines - [Web Analytics](https://agentuity.dev/services/observability/web-analytics.md): Track page views, user engagement, and custom events in your frontend ### Sandbox - [Running Code in Sandboxes](https://agentuity.dev/services/sandbox.md): Run code in isolated, secure containers with configurable resources - [Using the Sandbox API](https://agentuity.dev/services/sandbox/sdk-usage.md): Programmatic API for creating and managing sandboxes - [Creating and Using Snapshots](https://agentuity.dev/services/sandbox/snapshots.md): Save and restore sandbox filesystem states for faster cold starts ## Cookbook - [Cookbook](https://agentuity.dev/cookbook.md): Tutorials and patterns for building with Agentuity ### Tutorials - [Understanding How Agents Work](https://agentuity.dev/cookbook/tutorials/understanding-agents.md): Learn how AI agents use tools, run in loops with stopping conditions, and leverage LLMs to complete tasks autonomously - [Build a RAG Agent](https://agentuity.dev/cookbook/tutorials/rag-agent.md): Create a retrieval-augmented generation agent with vector search and citations ### Patterns - [Autonomous Research Agent](https://agentuity.dev/cookbook/patterns/autonomous-research.md): Build a recursive research loop using the Anthropic SDK with native tool calling - [Background Tasks](https://agentuity.dev/cookbook/patterns/background-tasks.md): Use waitUntil to run work after responding to the client - [Chat with Conversation History](https://agentuity.dev/cookbook/patterns/chat-with-history.md): Build a chat agent that remembers previous messages using thread state - [Cron with Storage](https://agentuity.dev/cookbook/patterns/cron-with-storage.md): Cache scheduled task results in KV for later retrieval - [Type-Safe API Calls with Hono RPC and TanStack Query](https://agentuity.dev/cookbook/patterns/hono-rpc-tanstack-query.md): Get end-to-end type safety between your Agentuity API routes and React frontend using Hono RPC and TanStack Query - [LLM as a Judge](https://agentuity.dev/cookbook/patterns/llm-as-a-judge.md): Use LLMs to evaluate and score agent outputs for quality, safety, and compliance - [SDK Utilities for External Apps](https://agentuity.dev/cookbook/patterns/server-utilities.md): Use storage, queues, logging, and error handling utilities from external backends like Next.js or Express - [Product Search with Vector](https://agentuity.dev/cookbook/patterns/product-search.md): Semantic product search with metadata filtering - [Tailwind CSS Setup](https://agentuity.dev/cookbook/patterns/tailwind-setup.md): Add Tailwind CSS styling to your Agentuity frontend - [Web Exploration with Sandboxes](https://agentuity.dev/cookbook/patterns/web-exploration.md): Run a headless browser in a sandbox to let agents browse, screenshot, and extract web content - [Webhook Handler](https://agentuity.dev/cookbook/patterns/webhook-handler.md): Handle incoming webhooks with signature verification and background processing #### Coder - [Managing Coder Sessions with the SDK](https://agentuity.dev/cookbook/patterns/creating-coder-sessions-with-sdk.md): Create a Coder session, read its state, and manage its lifecycle with CoderClient - [Creating Loop-Mode Coder Sessions](https://agentuity.dev/cookbook/patterns/creating-loop-mode-coder-sessions.md): Create a loop-mode Coder session and inspect its workflow state with getLoopState - [Choosing Built-In Agents for a Coder Session](https://agentuity.dev/cookbook/patterns/choosing-built-in-agents-for-a-coder-session.md): Use enabledAgents and defaultAgent to choose which built-in Coder agents are available in a session - [Attaching Skills to a Coder Session](https://agentuity.dev/cookbook/patterns/attaching-skills-to-a-coder-session.md): Save skills, group them into buckets, and attach them to a Coder session with CoderClient - [Using Workspaces to Reuse Repos, Skills, and Agent Selection](https://agentuity.dev/cookbook/patterns/using-workspaces-to-reuse-repos-skills-and-agent-selection.md): Store reusable Coder selections in a workspace and attach them to sessions with workspaceId - [Reconnecting to Existing Coder Sessions](https://agentuity.dev/cookbook/patterns/preparing-coder-sessions-for-remote-attach.md): Use listConnectableSessions and prepareSessionForRemoteAttach to find sessions you can still reconnect to - [Observing a Coder Session through the Hub](https://agentuity.dev/cookbook/patterns/observing-a-coder-session-through-the-hub.md): Subscribe to a session's live event stream, page through its event history, and hydrate a client from the durable replay stream ### Integrations - [Using Mastra with Agentuity](https://agentuity.dev/cookbook/integrations/mastra.md): Deploy Mastra agents on Agentuity with persistent state, observability, and the AI Gateway - [Using LangChain with Agentuity](https://agentuity.dev/cookbook/integrations/langchain.md): Build LangChain agents with Agentuity's deployment runtime, persistent storage, and observability - [Using OpenAI Agents SDK with Agentuity](https://agentuity.dev/cookbook/integrations/openai-agents.md): Run OpenAI Agents SDK tool calling, handoffs, and structured output on Agentuity's deployment runtime - [Using Claude Agent SDK with Agentuity](https://agentuity.dev/cookbook/integrations/claude-agent.md): Build conversational code intelligence agents with Claude Agent SDK and Agentuity sandboxes - [Using Chat SDK with Agentuity](https://agentuity.dev/cookbook/integrations/chat-sdk.md): Build multi-platform chatbots for Slack and Discord with Chat SDK and Agentuity agents - [Adding Agentuity to a Next.js App](https://agentuity.dev/cookbook/integrations/nextjs.md): Connect a Next.js frontend to an Agentuity backend using rewrites and direct router types - [Adding Agentuity to a TanStack Start App](https://agentuity.dev/cookbook/integrations/tanstack-start.md): Connect a TanStack Start frontend to an Agentuity backend using a Vite proxy and direct router types - [Adding Agentuity to a Turborepo Monorepo](https://agentuity.dev/cookbook/integrations/turborepo.md): Add Agentuity as a workspace app, share schemas across packages, and import router types directly ## Community - [Community Examples](https://agentuity.dev/community.md): Real-world integrations and tutorials built with Agentuity - [Inbound Email Agent](https://agentuity.dev/community/inbound-email-agent.md): Create an AI email auto-responder with Agentuity + Inbound webhooks. ## Reference - [Reference](https://agentuity.dev/reference.md): SDK, API, and CLI reference documentation - [Using Standalone Packages](https://agentuity.dev/reference/standalone-packages.md): Use Agentuity services from any Node.js or Bun application without the full runtime - [Automating Deployments with the GitHub App](https://agentuity.dev/reference/github-app.md): How the Agentuity GitHub App automates deployments from your repositories. - [Gravity Network](https://agentuity.dev/reference/gravity-network.md): The layered infrastructure powering Agentuity's services - [Migrating from v1 to v2](https://agentuity.dev/reference/migration-guide.md): Migrate from v1 to v2 for explicit routing, Hono-native routers, and standard Vite config. ### API Reference - [REST API Reference](https://agentuity.dev/reference/api.md): Direct HTTP access to Agentuity platform services - [API Keys API](https://agentuity.dev/reference/api/api-keys.md): Create and manage API keys for authentication - [Coder API](https://agentuity.dev/reference/api/coder.md): Manage Coder sessions, custom agents, session data, loop state, and known users through the REST API - [Databases API](https://agentuity.dev/reference/api/database.md): Execute queries, inspect tables, and monitor database performance - [Durable Streams API](https://agentuity.dev/reference/api/streams.md): Create durable, resumable data streams with public URLs - [Emails API](https://agentuity.dev/reference/api/email.md): Send and receive emails with managed addresses and webhook destinations - [Key-Value Storage API](https://agentuity.dev/reference/api/key-value.md): Store and retrieve arbitrary data by key within namespaces - [Machines API](https://agentuity.dev/reference/api/machines.md): Manage compute nodes and organization authentication enrollment - [Message Queues API](https://agentuity.dev/reference/api/queues.md): Publish, consume, and manage messages with worker and pub/sub queues - [OAuth Applications API](https://agentuity.dev/reference/api/oauth.md): Manage OAuth 2.0/OIDC applications, client credentials, user consent, and authorization scopes - [Object Storage API](https://agentuity.dev/reference/api/object-storage.md): Store and manage files and binary objects in buckets - [Organizations API](https://agentuity.dev/reference/api/organizations.md): Manage organizations, environment variables, and org-level resources - [Projects API](https://agentuity.dev/reference/api/projects.md): Full project lifecycle management including deployments, agents, environment variables, and hostnames - [Regions API](https://agentuity.dev/reference/api/regions.md): List available cloud regions and manage per-region resources - [Sandboxes API](https://agentuity.dev/reference/api/sandboxes.md): Create and manage isolated execution environments with full lifecycle, file system, snapshot, and checkpoint support - [Schedules API](https://agentuity.dev/reference/api/schedules.md): Create and manage cron-based scheduled jobs with destinations and delivery tracking - [Sessions API](https://agentuity.dev/reference/api/sessions.md): View agent execution sessions with timing, cost, and observability data - [Tasks API](https://agentuity.dev/reference/api/tasks.md): Full-featured task management with epics, features, bugs, comments, tags, attachments, and activity tracking - [Threads API](https://agentuity.dev/reference/api/threads.md): Manage conversation threads for agent session state and user data - [Users API](https://agentuity.dev/reference/api/user.md): Get authenticated user information and organization memberships - [Vector Search API](https://agentuity.dev/reference/api/vector.md): Semantic search with automatic embedding generation - [Webhooks API](https://agentuity.dev/reference/api/webhooks.md): Manage webhook endpoints, destinations, receipts, deliveries, and analytics ### CLI - [CLI Reference](https://agentuity.dev/reference/cli.md): Command-line tools for building, deploying, and managing agents - [AI Commands](https://agentuity.dev/reference/cli/ai-commands.md): CLI commands for AI agents, IDE integration, and schema inspection. - [Build Configuration](https://agentuity.dev/reference/cli/build-configuration.md): Customize the build process with Vite plugins and build-time constants - [Claude Code Plugin](https://agentuity.dev/reference/cli/claude-code-plugin.md): Install the Agentuity plugin for Claude Code to get auto-activated skills for deploying and building on Agentuity. - [Coder Commands](https://agentuity.dev/reference/cli/coder.md): Start and manage AI coding sessions connected to the Coder Hub - [Configuration Commands](https://agentuity.dev/reference/cli/configuration.md): Manage environment variables, secrets, and API keys from the CLI. - [Debugging Deployments](https://agentuity.dev/reference/cli/debugging.md): SSH into containers, inspect sessions, and troubleshoot issues in your deployed agents. - [Deploying to the Cloud](https://agentuity.dev/reference/cli/deployment.md): Deploy your agents to Agentuity Cloud with automatic infrastructure provisioning. - [Local Development](https://agentuity.dev/reference/cli/development.md): Run the development server with hot reload, type checking, and public URL support. - [Getting Started with the CLI](https://agentuity.dev/reference/cli/getting-started.md): Install the Agentuity CLI and authenticate to start building agents. - [Connecting GitHub Repositories](https://agentuity.dev/reference/cli/git-integration.md): Link your GitHub account and repositories to enable preview deployments and CI/CD. - [Infrastructure Monitoring](https://agentuity.dev/reference/cli/monitoring.md): Monitor machine health and resource usage from the CLI in real time or as a snapshot - [Managing OAuth Applications](https://agentuity.dev/reference/cli/oauth.md): Create and manage OAuth/OIDC applications for third-party integrations from the CLI - [OpenCode Plugin](https://agentuity.dev/reference/cli/opencode-plugin.md): Install the Agentuity plugin for OpenCode to enable AI-assisted development with specialized agents - [CLI Profiles](https://agentuity.dev/reference/cli/profiles.md): Use separate CLI profiles for different accounts, organizations, and environments. - [Sandbox Commands](https://agentuity.dev/reference/cli/sandbox.md): Create and manage isolated execution environments from the CLI - [Storage Commands](https://agentuity.dev/reference/cli/storage.md): Manage Key-Value, S3, Vector, Database, and Stream storage from the CLI. ### SDK Reference - [SDK Reference](https://agentuity.dev/reference/sdk-reference.md): TypeScript method signatures, parameters, and return types for the Agentuity SDK - [Agent Creation and Handlers](https://agentuity.dev/reference/sdk-reference/agents.md): Define agents with createAgent(), configure schemas, and write handlers - [Application Entry Point](https://agentuity.dev/reference/sdk-reference/application-entry.md): Initialize your Agentuity app with createApp() and configure the runtime entry file - [Coder Client](https://agentuity.dev/reference/sdk-reference/coder.md): Manage AI coding sessions, workspaces, and skills with CoderClient - [Calling Other Agents](https://agentuity.dev/reference/sdk-reference/communication.md): Call agents from routes or other agents with type-safe imports - [Context API](https://agentuity.dev/reference/sdk-reference/context-api.md): Storage, logging, and services available via the ctx.* object - [Using Email](https://agentuity.dev/reference/sdk-reference/email-service.md): Send emails and manage addresses with ctx.email - [Event System](https://agentuity.dev/reference/sdk-reference/events.md): Lifecycle hooks for monitoring agent, session, and thread events - [Logging and Telemetry](https://agentuity.dev/reference/sdk-reference/observability.md): Structured logging and OpenTelemetry tracing via ctx.logger and ctx.tracer - [Using Message Queues](https://agentuity.dev/reference/sdk-reference/queue-service.md): Publish messages and manage queues with ctx.queue - [Router and Routes](https://agentuity.dev/reference/sdk-reference/router.md): HTTP endpoints, middleware, WebSocket, SSE, and cron handlers - [Using Runtime Utilities](https://agentuity.dev/reference/sdk-reference/advanced.md): File imports, standalone execution, context detection, process lifecycle, and build metadata - [Using Sandboxes](https://agentuity.dev/reference/sdk-reference/sandbox-service.md): Run code in isolated containers with ctx.sandbox - [Using Schedules](https://agentuity.dev/reference/sdk-reference/schedule-service.md): Create and manage cron-based scheduled jobs with ctx.schedule - [Schema Validation](https://agentuity.dev/reference/sdk-reference/schema.md): Type-safe runtime validation with StandardSchema support - [Storage APIs](https://agentuity.dev/reference/sdk-reference/storage.md): KV, Vector, Database, Object, and Stream storage reference - [Using Tasks](https://agentuity.dev/reference/sdk-reference/task-service.md): Track work items with lifecycle management via ctx.task