Skip to main content

Overview

While the simple examples demonstrate the core concepts, production implementations showcase how ACP is used in real-world applications with additional patterns for error handling, state management, and integration with AI models.

Gemini CLI Agent

Google Gemini CLI

A complete, production-ready ACP agent implementation using Google’s Gemini AI models
The Gemini CLI Agent is an excellent reference for building production-grade agents. It demonstrates:

LLM Integration

Complete integration with Google’s Gemini API including streaming responses and function calling

Robust Error Handling

Comprehensive error handling, retry logic, and graceful degradation

Advanced Tool Management

Dynamic tool registration, execution, and result handling

Production Patterns

Real-world patterns for state management, logging, and debugging

Production Architecture Patterns

Agent Architecture

1

Modular Design

Separate concerns into distinct components:
2

State Management

Maintain comprehensive session state:
3

Error Boundaries

Implement robust error handling at each layer:
4

Streaming Integration

Stream LLM responses in real-time:

Client Architecture

1

Agent Lifecycle Management

Manage agent processes robustly:
2

Permission Policies

Implement sophisticated permission handling:
3

UI Integration

Connect ACP to your application’s UI:

Best Practices from Production

Logging and Observability

Performance Optimization

Security Considerations

Production implementations must carefully consider security:
  • Path validation: Always validate and sanitize file paths
  • Permission boundaries: Enforce strict permission policies
  • Resource limits: Limit agent resource consumption (CPU, memory, file I/O)
  • Audit logging: Log all sensitive operations
  • Input sanitization: Validate all user inputs before passing to agents
Path Security

Testing Strategies

Common Integration Patterns

MCP Server Integration

Integrate with Model Context Protocol servers:

Multi-Session Management

Handle multiple concurrent sessions:

Additional Resources

Gemini CLI Source

View the complete Gemini CLI Agent implementation

Protocol Specification

Deep dive into the ACP protocol details

API Reference

Complete TypeScript SDK documentation

Community Examples

Share and discover community implementations

Contributing Your Examples

Built something with ACP? We’d love to feature it! Share your implementation:
  1. Open a GitHub Discussion
  2. Include a link to your code
  3. Describe what makes your implementation unique
  4. Share any lessons learned
Outstanding community examples may be featured in the official documentation.