Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

agent-tools-at-arms-length

Keep your agent safe from untrusted tools and prevent credential leaks.

About

Run Claude Code or another agent in a minimal container to avoid security leaks that can happen when installing untrusted applications and sharing credentials in the same container as the agent.

  • Avoid exposing your host system or credentials to the agent.
  • Rely on safe tools provided by the coding agent.
  • Add tailored agent skills.

What about untrusted third-party tools and credentials?

  • Third-party tools and credentials are handled in separate containers and made available to the coding agent via a gateway approach.

How to Use

Run this like you would any other CLI-based agent:

  • in terminal, run docker compose up --build
  • in terminal, connect to container via docker compose exec agent /bin/bash
  • launch claude in the default /workspace folder and then login

Load up your agent with skills and plugins.

Example: OpenAI Image Generation Service

This project includes an example service that demonstrates the gateway pattern for safely integrating third-party tools.

The source of the OpenAI Image Generation Service is available at:

https://github.com/briangershon/openai-image-gen

Adding the Service

The openai-image-gen service is defined in docker-compose.yml:

openai-image-gen:
  image: ghcr.io/briangershon/openai-image-gen:latest
  security_opt:
    - no-new-privileges:true
  tmpfs:
    - /tmp
  secrets:
    - openai_api_key
  volumes:
    - ./workspace/generated-images:/app/images:rw
  networks:
    - agent-network
  # Port NOT exposed to host - only internal access

Key features:

  • Runs on internal agent-network (not exposed to host)
  • API credentials managed via Docker secrets
  • Generated images stored in shared workspace
  • No privilege escalation allowed

Setup

  1. Create the secrets directory and add your OpenAI API key:
mkdir -p secrets
echo "your-openai-api-key-here" > secrets/openai_api_key.txt
  1. Start the services:
docker compose up --build

Using from the Agent Container

From inside the agent container, call the service via the internal network:

# Connect to agent container
docker compose exec agent /bin/bash

# Generate an image
curl -X POST http://openai-image-gen:5000/generate \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A serene mountain landscape at sunset",
    "model": "dall-e-3",
    "size": "1024x1024",
    "quality": "standard"
  }' | jq .

# Images are saved to /workspace/generated-images/
ls /workspace/generated-images/

The service returns JSON with image URLs and metadata. Generated images are accessible in the shared workspace/generated-images directory.

Goals

  • Run the coding agent in an agent container with access only to the current working directory, with no access to the rest of the host system.
  • Persist the coding agent's credentials inside the container so you stay logged in after the initial setup. Since projects may require different credentials, avoid switching LLM accounts when moving between projects.
  • Do not run untrusted third-party applications in the agent container.
  • Rely on Agent Skills to provide additional features and knowledge.
  • Use a gateway container to expose tools running in other containers, keeping third-party tools and their credentials separate from the agent.

About

Keep your agent safe from untrusted tools and prevent credential leaks.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors