Crate miyabi_a2a

Crate miyabi_a2a 

Source
Expand description

Miyabi A2A - Agent-to-Agent Task Storage and Communication

This crate provides task storage and communication infrastructure for agent-to-agent (A2A) collaboration in the Miyabi framework.

§Overview

A2A enables multiple agents to coordinate work by sharing tasks through a persistent storage backend. The primary implementation uses GitHub Issues as the storage layer, providing:

  • Natural task visualization (github.com UI)
  • Built-in authentication and access control
  • Webhook integration for real-time updates
  • No additional infrastructure required

§Examples

use miyabi_a2a::{GitHubTaskStorage, TaskStorage, A2ATask, TaskStatus, TaskType};
use chrono::Utc;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create storage backend
    let storage = GitHubTaskStorage::new(
        std::env::var("GITHUB_TOKEN")?,
        "owner".to_string(),
        "repo".to_string(),
    )?;

    // Create a new task
    let task = A2ATask {
        id: 0, // Will be assigned by storage
        title: "Implement feature X".to_string(),
        description: "Details...".to_string(),
        status: TaskStatus::Submitted,
        task_type: TaskType::CodeGeneration,
        agent: None,
        context_id: Some("project-123".to_string()),
        priority: 3,
        retry_count: 0,
        created_at: Utc::now(),
        updated_at: Utc::now(),
        issue_url: String::new(),
    };

    // Save task
    let task_id = storage.save_task(task).await?;
    println!("Created task #{}", task_id);

    // Retrieve task
    if let Some(task) = storage.get_task(task_id).await? {
        println!("Task: {}", task.title);
    }

    Ok(())
}

Re-exports§

pub use error::A2AError;
pub use error::A2AResult;
pub use storage::cursor::CursorError;
pub use storage::cursor::Direction;
pub use storage::cursor::PaginatedResult;
pub use storage::cursor::PaginationCursor;
pub use storage::github::GitHubTaskStorage;
pub use storage::StorageError;
pub use storage::TaskFilter;
pub use storage::TaskStorage;
pub use storage::TaskUpdate;
pub use task::A2ATask;
pub use task::TaskStatus;
pub use task::TaskType;
pub use rpc::push_notification::generate_webhook_signature;
pub use rpc::push_notification::send_push_notification;
pub use rpc::push_notification::PushNotificationPayload;
pub use rpc::push_notification::WebhookConfig;
pub use rpc::push_notification_config::ConfigStorage;
pub use rpc::push_notification_config::MemoryConfigStorage;
pub use rpc::push_notification_config::PushNotificationConfig;

Modules§

auth
Authentication and authorization for A2A Protocol.
error
Error types for A2A protocol
http
HTTP REST API server for Miyabi Dashboard
rpc
RPC module for A2A Protocol
storage
Task storage abstraction
task
A2A Task definitions
types
Type definitions for A2A Protocol