Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .fernignore
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
# Specify files that shouldn't be modified by Fern

# Hand-written custom commands (the "agents-as-code" workflow).
# These must never be overwritten by `fern generate`.
cli/elevenlabs/custom.rs
cli/elevenlabs/workflow/

# Hand-maintained README + assets (Fern generates a default README;
# we own it to document the agents-as-code workflow and hero image).
README.md
assets/
67 changes: 65 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# ElevenLabs API Documentation CLI
# ElevenLabs CLI — Agents as Code

Command-line interface for the ElevenLabs API Documentation API.
![hero](./assets/Cover.png)

Command-line interface for the [ElevenLabs platform](https://elevenlabs.io/docs/agents-platform/overview).

The CLI does two things:

- **Full API access** — every ElevenLabs API endpoint is available as a subcommand (`elevenlabs <resource> <method>`).
- **Agents as Code** — manage Conversational AI agents from local configuration files, with templates, branches, and push/pull sync.

## Table of contents

- [Installation](#installation)
- [Authentication](#authentication)
- [Quick start](#quick-start)
- [Agents as Code](#agents-as-code)
- [Usage](#usage)
- [Documentation](#documentation)
- [Advanced](#advanced)
Expand Down Expand Up @@ -58,6 +66,61 @@ elevenlabs <resource> <method>

Run `elevenlabs <resource> --help` to see available methods for a resource.

## Agents as Code

Manage Conversational AI agents from local configuration files. `elevenlabs agents init` scaffolds a project; agent configs live as JSON on disk and sync to ElevenLabs. Pulled configs are stored as raw wire JSON and pushed back verbatim, so they round-trip losslessly.

### Project structure

```
your_project/
├── agents.json # Agent registry: ids + branch mappings → config paths
├── tools.json # Tool registry
├── tests.json # Test registry
├── agent_configs/ # Agent configuration files
├── tool_configs/ # Tool configuration files
└── test_configs/ # Test configuration files
```

### Commands

```bash
# Scaffold a new project (pass a path, or --override to reset an existing one)
elevenlabs agents init [path] [--override]

# Inspect locally-configured agents
elevenlabs agents list
elevenlabs agents status

# List available agent templates
elevenlabs agents templates list

# Print an embeddable HTML widget snippet for an agent
elevenlabs agents widget <agent_id>

# List an agent's branches (e.g. staging vs production)
elevenlabs agents branches list --agent <agent_id> [--include-archived]

# Delete an agent locally and in ElevenLabs
elevenlabs agents delete <agent_id>
elevenlabs agents delete --all
```

> Additional agents-as-code commands (`add`, `push`, `pull`, `test`) and the `tools` / `tests` command groups are being ported from v0 and will land in follow-up changes.

### Templates

Pre-built starting configurations, listed by `elevenlabs agents templates list`:

| Template | Description |
|----------|-------------|
| `default` | Complete configuration with all available fields and sensible defaults |
| `minimal` | Minimal configuration with only essential fields |
| `voice-only` | Optimized for voice-only conversations |
| `text-only` | Optimized for text-only conversations |
| `customer-service` | Pre-configured for customer service scenarios |
| `assistant` | General purpose AI assistant configuration |

## Usage

Every API resource appears as a subcommand (e.g. `elevenlabs <resource> <method>`). Run `elevenlabs <resource> --help` to see available methods.
Expand Down
Binary file added assets/Cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 19 additions & 34 deletions cli/elevenlabs/custom.rs
Original file line number Diff line number Diff line change
@@ -1,41 +1,26 @@
//! Custom command handlers.
//! Custom command handlers for the ElevenLabs "agents-as-code" workflow.
//!
//! This file is yours to edit — add it to `.fernignore` so
//! `fern generate` will never overwrite your changes.
//! This file and the `workflow/` module tree are hand-written and are
//! protected from regeneration by `.fernignore`
//! (`cli/elevenlabs/custom.rs` and `cli/elevenlabs/workflow/`). The
//! generated `main.rs` calls `custom::register(app)` at startup, composing
//! these commands into the CLI at compile time.
//!
//! The generated `main.rs` calls `custom::register(app)` at
//! startup, composing your commands into the CLI at compile time.
//!
//! Each handler receives an `AppContext`. Use `super::sdk::client(ctx)`
//! to get a fully-wired SDK client that inherits the CLI's auth,
//! retries, TLS, and global headers. Use `super::sdk::block_on(future)`
//! to run async SDK calls from synchronous handler context.
//! Types are available via `elevenlabs_sdk::api::*`.
//! Handlers get a fully-wired SDK client via `super::sdk::client(ctx)`
//! (inherits auth, retries, TLS, base URL, and global headers) and run
//! async SDK calls with `super::sdk::block_on(future)`. Types come from
//! `elevenlabs_sdk::api::*`.

use fern_cli_sdk::app::CliApp;

/// Register custom commands on the CLI app builder.
///
/// Called from `main.rs` during startup. Uncomment the example
/// below and adapt it to your API to get started.
// The workflow module tree lives at `cli/elevenlabs/workflow/`. Because
// this file is `custom.rs` (not `mod.rs`), point `mod` at the directory
// explicitly so the tree sits alongside the generated files rather than
// under a `custom/` subdirectory.
#[path = "workflow/mod.rs"]
mod workflow;

/// Register all custom commands on the CLI app builder.
pub fn register(app: CliApp) -> CliApp {
// Example: typed SDK client usage with the co-generated SDK.
//
// use elevenlabs_sdk::api::*;
//
// let app = app.command(
// clap::Command::new("get-plant")
// .about("Fetch a plant by its ID")
// .arg(clap::Arg::new("plant-id").required(true)),
// |matches, ctx| {
// let plant_id = matches.get_one::<String>("plant-id").unwrap();
// let client = super::sdk::client(ctx);
// let plant = super::sdk::block_on(
// client.plants.get_plant(plant_id, None),
// )?;
// println!("{}", serde_json::to_string_pretty(&plant).unwrap());
// Ok(())
// },
// );
app
workflow::register(app)
}
Loading
Loading