Configuration¶
SimpleAcp can be configured at multiple levels: global configuration, server options, and client options.
Global Configuration¶
Use the global configure block to set default options:
SimpleAcp.configure do |config|
config.default_storage = :memory # :memory, :redis, or :postgresql
config.logger = Logger.new(STDOUT)
end
Server Configuration¶
Basic Options¶
Storage Backend¶
Choose the appropriate storage backend for your deployment:
Best for: Development, testing, single-process deployments
require 'simple_acp/storage/redis'
storage = SimpleAcp::Storage::Redis.new(
url: ENV['REDIS_URL'] || 'redis://localhost:6379',
ttl: 86400, # 24 hours (default)
prefix: 'acp:' # Key prefix (default)
)
server = SimpleAcp::Server::Base.new(storage: storage)
Best for: Multi-process deployments, horizontal scaling
require 'simple_acp/storage/postgresql'
storage = SimpleAcp::Storage::PostgreSQL.new(
url: ENV['DATABASE_URL'] || 'postgres://localhost/simple_acp',
skip_setup: false # Auto-create tables (default: false)
)
server = SimpleAcp::Server::Base.new(storage: storage)
Best for: Production deployments, data persistence
HTTP Server Options¶
When running the HTTP server with Falcon:
Falcon uses fiber-based concurrency, efficiently handling thousands of concurrent SSE connections without manual thread configuration.
Client Configuration¶
Basic Options¶
client = SimpleAcp::Client::Base.new(
base_url: 'http://localhost:8000',
timeout: 30 # Request timeout in seconds
)
With Authentication¶
client = SimpleAcp::Client::Base.new(
base_url: 'http://localhost:8000',
headers: {
'Authorization' => "Bearer #{ENV['API_TOKEN']}"
}
)
Session Configuration¶
# Use a specific session for stateful interactions
client.use_session("user-123-session")
# All subsequent requests will use this session
client.run_sync(agent: "stateful-agent", input: "...")
client.run_sync(agent: "stateful-agent", input: "...")
# Clear when done
client.clear_session
Environment Variables¶
SimpleAcp respects these environment variables:
| Variable | Purpose | Default |
|---|---|---|
REDIS_URL |
Redis connection URL | redis://localhost:6379 |
DATABASE_URL |
PostgreSQL connection URL | postgres://localhost/acp |
Agent Configuration¶
When registering agents, you can configure:
server.agent(
"my-agent",
description: "Description shown in manifest",
input_content_types: ["text/plain", "application/json"],
output_content_types: ["text/plain"]
) do |context|
# Agent logic
end
Agent Options¶
| Option | Type | Description |
|---|---|---|
description |
String | Human-readable description |
input_content_types |
Array | Accepted input MIME types |
output_content_types |
Array | Output MIME types produced |
metadata |
Hash | Custom metadata |
Logging¶
Configure logging for debugging:
# Enable debug logging
SimpleAcp.configure do |config|
config.logger = Logger.new(STDOUT)
config.logger.level = Logger::DEBUG
end
Next Steps¶
- Explore Core Concepts
- Learn about Storage Backends in detail
- Read the Server Guide for advanced features