CLI Reference¶
Command-line interface for Akordi Agents SDK.
Installation¶
The CLI is installed automatically with the SDK:
Or with Poetry:
Commands¶
akordi-cli¶
Main CLI entry point for interactive agent chat.
Options¶
| Option | Description | Default |
|---|---|---|
--agent |
Agent name to use | default |
--model |
LLM model ID | Claude 3 Sonnet |
--temperature |
LLM temperature | 0.1 |
--max-tokens |
Maximum response tokens | 4096 |
--system |
System message | Default prompt |
--user-id |
User ID for chat history | Generated |
--chat-id |
Chat ID for persistence | Generated |
--help |
Show help message | - |
Examples¶
# Basic interactive chat
akordi-cli
# With custom model
akordi-cli --model anthropic.claude-3-opus-20240229-v1:0
# With custom settings
akordi-cli --temperature 0.5 --max-tokens 2000
# With chat persistence
akordi-cli --user-id user-123 --chat-id chat-456
create-guardrail¶
Create and manage AWS Bedrock guardrails.
Options¶
| Option | Description |
|---|---|
--create-default |
Create default guardrail configuration |
--create-version |
Create a new version of existing guardrail |
--guardrail-id |
Guardrail ID (for version creation) |
--list |
List all guardrails |
--region |
AWS region |
--help |
Show help message |
Examples¶
# Create default guardrail
create-guardrail --create-default
# Create version
create-guardrail --create-version --guardrail-id gr-abc123
# List all guardrails
create-guardrail --list
# Specify region
create-guardrail --create-default --region us-east-1
Interactive Chat¶
The CLI provides an interactive chat interface:
$ akordi-cli
🤖 Akordi Agent CLI
==================
Type 'quit' or 'exit' to end the session.
Type 'clear' to clear chat history.
Type 'help' for available commands.
You: Hello!
Agent: Hello! How can I help you today?
You: What is machine learning?
Agent: Machine learning is a subset of artificial intelligence...
You: quit
Goodbye! 👋
Special Commands¶
| Command | Description |
|---|---|
quit, exit, q |
Exit the CLI |
clear |
Clear chat history |
help, ? |
Show available commands |
history |
Show conversation history |
save |
Save conversation to file |
config |
Show current configuration |
Environment Variables¶
The CLI respects these environment variables:
| Variable | Description |
|---|---|
AWS_REGION |
AWS region for Bedrock |
CHAT_SESSIONS_TABLE_NAME |
DynamoDB sessions table |
CHAT_MESSAGES_TABLE_NAME |
DynamoDB messages table |
GUARDRAIL_ID |
Default guardrail ID |
GUARDRAIL_VERSION |
Default guardrail version |
Configuration File¶
Create ~/.akordi/config.yaml for persistent configuration:
# ~/.akordi/config.yaml
agent:
name: my_agent
model: anthropic.claude-3-sonnet-20240229-v1:0
temperature: 0.1
max_tokens: 4096
aws:
region: us-east-1
chat:
sessions_table: my-sessions
messages_table: my-messages
guardrails:
id: gr-abc123
version: "1"
Programmatic Usage¶
Use CLI components in your code:
from CLI.main import main
from CLI.chat_interface import ChatInterface
from CLI.config_manager import ConfigManager
# Use config manager
config = ConfigManager()
config.load()
print(config.get("agent.model"))
# Use chat interface
chat = ChatInterface(
agent_name="my_agent",
llm_service=my_llm_service,
)
chat.start()
Troubleshooting¶
Authentication Errors¶
# Verify AWS credentials
aws sts get-caller-identity
# Refresh credentials if needed
./setup-codeartifact.sh
Model Access¶
# Check if model is available
aws bedrock list-foundation-models --query "modelSummaries[?modelId=='anthropic.claude-3-sonnet-20240229-v1:0']"