
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
A Rust implementation of the Agent-to-Agent (A2A) Protocol, providing a type-safe, idiomatic way to build agent communication systems.
Add to your Cargo.toml
:
[dependencies]
a2a-rs = "0.1.0"
# For HTTP client
a2a-rs = { version = "0.1.0", features = ["http-client"] }
# For HTTP server
a2a-rs = { version = "0.1.0", features = ["http-server"] }
# Full feature set
a2a-rs = { version = "0.1.0", features = ["full"] }
use a2a_rs::{HttpClient, Message};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = HttpClient::new("https://api.example.com".to_string());
let message = Message::user_text("Hello, agent!".to_string());
let task = client.send_task_message("task-123", &message, None, None).await?;
println!("Task created: {:?}", task);
Ok(())
}
use a2a_rs::{HttpServer, Message, Task, A2AError};
use a2a_rs::port::{AsyncTaskHandler, AgentInfoProvider};
struct MyAgent;
#[async_trait::async_trait]
impl AsyncTaskHandler for MyAgent {
async fn handle_message(
&self,
task_id: &str,
message: &Message,
session_id: Option<&str>,
) -> Result<Task, A2AError> {
// Process the message and return updated task
Ok(Task::new(task_id.to_string()))
}
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let server = HttpServer::new(
MyAgent,
AgentInfo::default(),
"127.0.0.1:8080".to_string(),
);
server.start().await?;
Ok(())
}
This library follows a hexagonal architecture pattern:
client
- Client-side functionalityserver
- Server-side functionalityhttp-client
- HTTP client implementationhttp-server
- HTTP server implementationws-client
- WebSocket client implementationws-server
- WebSocket server implementationauth
- Authentication support (JWT, OAuth2, OpenID Connect)sqlx-storage
- SQLx-based persistent storagesqlite
- SQLite database supportpostgres
- PostgreSQL database supportmysql
- MySQL database supporttracing
- Structured logging and tracingfull
- All features enabledSee the examples directory for complete working examples:
Full API documentation is available on docs.rs.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
FAQs
Unknown package
We found that a2a-rs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.