CLI
Command-line interface for interacting with A2A agents
A2A Command Line Interface
The A2A CLI provides a convenient way to interact with A2A-compatible agents from the command line. It's useful for testing, debugging, and automating interactions with agents.
Installation
You can install the A2A CLI using pip:
Or clone the repository and install from source:
Basic Usage
Discovering Agents
You can discover an agent's capabilities by fetching its Agent Card:
This will display the agent's name, description, skills, and supported modes of interaction.
Creating Tasks
To create a new task with an agent:
If the agent requires authentication:
Getting Task Status
After creating a task, you can check its status:
Interactive Mode
For multi-turn conversations, you can use interactive mode:
This will start a session where you can chat with the agent in a REPL-like interface.
Advanced Features
Streaming Responses
To stream responses from agents that support SSE:
Multi-Part Messages
You can send multi-part messages, including files:
Saving Artifacts
To save artifacts from a task to a local file:
Push Notifications
You can register for push notifications:
And then get the current notification settings:
Scripting and Automation
Environment Variables
The CLI supports environment variables for common parameters:
JSON Output
For scripting, you can request JSON output:
Batch Processing
Process multiple messages in batch mode:
Where messages.txt
contains one message per line.
Configuration
You can create a configuration file to store commonly used settings:
List current configuration:
Agent Comparison
Compare responses from multiple agents:
Task Management
List recent tasks:
Cancel a running task:
Development Tools
Validate Agent Card
Check if an Agent Card follows the A2A specification:
Mock Server
Start a mock A2A server for testing:
Examples
Simple Weather Query
Multi-turn Conversation
Working with Files
Troubleshooting
Logging
Enable detailed logging for debugging:
For even more detail:
Connection Issues
Test the connection to an A2A server:
Common Errors
- Authentication Failures: Check that your auth token is valid
- Invalid URL: Ensure the URL ends with
/a2a
or is the correct endpoint - Timeout Errors: Try increasing the timeout with
--timeout 60
- Format Errors: Verify the agent supports the content type you're sending
Summary
The A2A CLI provides a powerful interface for interacting with A2A-compatible agents from the command line. It supports both simple interactions and advanced features like streaming, multi-turn conversations, and working with multi-modal content.