This repository contains a Tangle Network Blueprint service that enables the creation, deployment, and management of AI agents built with the Coinbase Agent Kit. It provides a secure, containerized environment for running AI agents with seamless integration to blockchain and web services.
The Coinbase Agent Kit Blueprint allows you to:
- Create AI agents with different capabilities
- Deploy agents in Docker containers or Trusted Execution Environments (TEEs)
- Manage API keys securely for each agent
- Interact with deployed agents via CLI, HTTP API, or autonomous mode
Pre-built Docker images are required for TEE deployment, as the TEE infrastructure doesn't support building images from source during the deployment process:
-
Build and push the image to your registry:
# Set your registry export REGISTRY=ghcr.io/your-username # Run the build script ./templates/starter/scripts/build_and_push.sh
-
Use the pre-built image in your deployment:
# Set the image to use export DOCKER_IMAGE=ghcr.io/your-username/coinbase-agent:latest # Deploy your agent (the image will be used instead of building) # Your regular deployment command here
Using pre-built images also helps avoid disk space issues during local deployment and speeds up the deployment process overall.
The docker-compose.yml template is configured to use the DOCKER_IMAGE
environment variable if set, otherwise it will fall back to building the image locally (which only works for non-TEE deployments).
If you encounter "no space left on device" errors when building the Docker image:
-
Clear Docker resources:
# Remove all unused Docker resources (images, containers, volumes, etc.) docker system prune -a --volumes
-
Increase Docker's disk space allocation:
- Docker Desktop (Mac/Windows): Go to Settings β Resources β Advanced and increase the disk image size
- Linux: Edit
/etc/docker/daemon.json
to specify a larger size or different location
-
Use BuildKit for more efficient builds:
DOCKER_BUILDKIT=1 docker build -t coinbase-agent:latest .
-
Use a remote build service: Consider using GitHub Actions, GitLab CI, or a dedicated build server with more resources
The system consists of several key components:
- Tangle Blueprint Service: A Rust-based service that exposes jobs and queries for agent management
- Agent Templates: TypeScript templates for different agent types in the
templates/
directory - Docker Deployment: Infrastructure for containerizing and running agents
- TEE Integration: Optional secure enclave deployment for sensitive agents
The service provides two main job handlers:
create_agent
: Generates agent files from templates based on configurationdeploy_agent
: Deploys the agent as a Docker container or TEE
You can extend the Blueprint to support your own agent types by modifying the following components:
Add your agent template to the templates/
directory. See Templates README for detailed instructions.
If your agent requires special customization, modify this logic in the TypeScript project. Add your agent's services and tests to ensure it works locally before updating the Dockerfile and docker-compose.yml file.
In the Typescript project, you can expose new functionality for your agent by adding new files to the src/
directory. You can modify on-demand configuration through new environment variables, such as for prompts, models, and other configurations that the Rust environment can pass to the docker deployment.
In your Typescript project, update the docker-compose.yml
file to add your agent's services and tests to ensure it works with the Docker deployment.
If your agent requires special deployment configuration, modify src/deploy_agent.rs
:
fn deploy_docker_container(
agent_dir: &Path,
agent_id: &str,
deployment_id: &str,
config: &GadgetConfiguration,
) -> Result<Option<String>, String> {
// Add specialized configuration for your agent type
// ...
}
When extending the Blueprint with your own agent types:
- API Key Management: Follow the secure pattern for handling API keys in
.env
files - TEE Integration: Use TEEs for agents handling sensitive data or private keys
- Access Control: Implement appropriate access controls for your agent APIs
- Dependency Security: Regularly update dependencies in your templates
See the Testing Guide for details on testing your custom agent integration, including:
- Unit tests for your customization logic
- Integration tests for the full agent lifecycle
- End-to-end tests for deployment and interaction
- Templates Guide - How to create and customize agent templates
This project is licensed under the MIT License - see the LICENSE file for details.