Overview
The Agents API allows you to create, manage, and deploy AI agents on the Runloop platform. Agents can be sourced from Git repositories, npm packages, PyPI packages, or Runloop Objects. Once created, agents can be mounted to Devboxes and used in your workflows.Agent Source Types
Runloop supports four types of agent sources:| Source Type | Description | Use Case |
|---|---|---|
| Git | Clone an agent from a Git repository | Custom agents, open source agents |
| npm | Install an agent from npm registry | Node.js-based agents |
| pip | Install an agent from PyPI | Python-based agents |
| Object | Use an agent from a Runloop Object | Pre-packaged agent bundles, custom builds. A Git repository can also be uploaded as an object and will initialize faster than cloning. |
Creating Agents
Creating an Agent from a Git Repository
Create an agent by cloning a Git repository. This is ideal for custom agents or open source agents hosted on GitHub, GitLab, or other Git providers.Creating an Agent from an npm Package
Create an agent from an npm package. The package will be installed globally when the devbox is created.Creating an Agent from a PyPI Package
Create an agent from a PyPI package. The package will be installed globally when the devbox is created.Creating an Agent from a Storage Object
Create an agent from a Runloop Object. This is useful for pre-packaged agent bundles, custom builds, or agents that require specific file structures.Before creating an object-based agent, you need to upload your agent files as a Runloop Object. See the Runloop Objects documentation for details on creating objects.
Step 1: Upload Agent Files as a Runloop Object
First, package your agent files and upload them as an object. You can upload a tar archive (.tar, .tar.gz, .tgz) or a single file.
Step 2: Create Agent from Runloop Object
Once you have the object ID, create an agent using the object source. You can optionally provide setup commands to run after unpacking the object.Complete Example: Creating an Object-Based Agent
Here’s a complete example that packages agent files, uploads them, and creates an agent:Retrieving Agents
Get a Specific Agent
Retrieve details about a specific agent by its ID.Listing Agents
List Your Agents
Retrieve a list of all agents in your account.Agent Versioning
Agents use semantic versioning (semver) or Git SHAs for versioning. When creating an agent, specify a version string:- Semver format:
"1.0.0","2.1.5","0.1.0-alpha" - Git SHA:
"abc123def456..."(full or partial commit SHA)
Using Agents with Devboxes
Once you’ve created an agent, you can mount it onto a Devbox. See the Agent Mounts documentation for details on using agents with Devboxes.Best Practices
Agent Naming
-
Use descriptive names: Choose clear, meaningful names for your agents
- ✅
code-review-agent - ❌
agent1
- ✅
-
Use consistent versioning: Follow semantic versioning for predictable releases
- ✅
1.0.0,1.1.0,2.0.0 - ❌
v1,latest,new
- ✅
Source Type Selection
- Git: Best for version-controlled agents, custom development, open source agents
- npm: Best for Node.js-based agents available on npm
- pip: Best for Python-based agents available on PyPI
- Object: Best for pre-packaged agents, custom builds, or agents with complex dependencies
Object-Based Agents
- Include setup commands: Use
agent_setupto automate installation and configuration - Check compatibility: Object-based agents are particularly useful when developing agents in compiled languages. Make sure that any compiled binaries work on all target platforms.
Security
- Private repositories: Use authentication tokens for private Git repositories
- Sensitive data: Avoid storing secrets or API keys in agent packages and within Runloop Objects
Related Documentation
- Agent Mounts - Mount agents to Devboxes
- Objects - Upload and manage storage objects
- API Reference: Create an Agent - Full API documentation
- API Reference: Get an Agent - Retrieve agent details
- API Reference: List Agents - List your agents
