{"id":48839697,"url":"https://github.com/lispking/agent-io","last_synced_at":"2026-04-15T01:03:43.668Z","repository":{"id":341312821,"uuid":"1167571928","full_name":"lispking/agent-io","owner":"lispking","description":"A Rust SDK for building AI agents with multi-provider LLM support.","archived":false,"fork":false,"pushed_at":"2026-03-01T05:19:07.000Z","size":134,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-01T06:40:45.818Z","etag":null,"topics":["agent","ai","llm","multi-provider","sdk"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/agent-io","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lispking.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-26T12:50:34.000Z","updated_at":"2026-03-01T05:19:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/lispking/agent-io","commit_stats":null,"previous_names":["lispking/agent-io"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/lispking/agent-io","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lispking%2Fagent-io","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lispking%2Fagent-io/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lispking%2Fagent-io/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lispking%2Fagent-io/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lispking","download_url":"https://codeload.github.com/lispking/agent-io/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lispking%2Fagent-io/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31821686,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T18:05:02.291Z","status":"ssl_error","status_checked_at":"2026-04-14T18:05:01.765Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","ai","llm","multi-provider","sdk"],"created_at":"2026-04-15T01:03:40.708Z","updated_at":"2026-04-15T01:03:43.655Z","avatar_url":"https://github.com/lispking.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Agent IO\n\n[![Crates.io](https://img.shields.io/crates/v/agent-io.svg)](https://crates.io/crates/agent-io)\n[![Documentation](https://docs.rs/agent-io/badge.svg)](https://docs.rs/agent-io)\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache2.0-yellow.svg)](https://opensource.org/license/apache-2-0)\n[\u003cimg alt=\"build status\" src=\"https://img.shields.io/github/actions/workflow/status/lispking/agent-io/ci.yml?branch=main\u0026style=for-the-badge\" height=\"20\"\u003e](https://github.com/lispking/agent-io/actions?query=branch%3Amain)\n[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/lispking/agent-io)\n\nA Rust SDK for building AI agents with multi-provider LLM support.\n\n## Features\n\n- **Multi-provider LLM support**: OpenAI, Anthropic, Google Gemini, and OpenAI-compatible providers\n- **Tool/Function calling**: Built-in tool system — define tools with a simple `#[tool]` macro\n- **Streaming responses**: Event-based real-time response handling\n- **Context compaction**: Automatic management of long conversation context\n- **Token tracking**: Usage tracking and cost calculation across providers\n- **Retry mechanism**: Built-in exponential backoff retry for rate limit handling\n- **Memory system**: In-memory memory by default, with optional LanceDB persistence via feature flag\n\n## Installation\n\n```toml\n[dependencies]\nagent-io = { version = \"0.3\", features = [\"openai\"] }\ntokio = { version = \"1\", features = [\"full\"] }\n```\n\nEnable `memory-lancedb` only if you need persistent vector-backed memory:\n\n```toml\nagent-io = { version = \"0.3\", features = [\"openai\", \"memory-lancedb\"] }\n```\n\n## Quick Start\n\n### Basic Usage\n\n```rust,no_run\nuse std::sync::Arc;\nuse agent_io::{Agent, llm::ChatOpenAI};\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let llm = ChatOpenAI::new(\"gpt-4o\")?;\n    let agent = Agent::builder()\n        .with_llm(Arc::new(llm))\n        .build()?;\n\n    let response = agent.query(\"Hello!\").await?;\n    println!(\"{}\", response);\n    Ok(())\n}\n```\n\n### Defining Tools with `#[tool]`\n\nThe `#[tool]` macro eliminates boilerplate — just write a plain `async fn`:\n\n```rust,no_run\nuse std::sync::Arc;\nuse agent_io::{Agent, llm::ChatOpenAI, tool};\n\n/// Get the current weather for a city\n#[tool(location = \"The city name to fetch weather for\")]\nasync fn get_weather(location: String) -\u003e agent_io::Result\u003cString\u003e {\n    Ok(format!(\"Weather in {location}: Sunny, 25°C\"))\n}\n\n/// Evaluate a simple arithmetic expression\n#[tool(expression = \"The expression to evaluate, e.g. '15 * 7'\")]\nasync fn calculator(expression: String) -\u003e agent_io::Result\u003cString\u003e {\n    // ... implementation\n    Ok(\"Result: 105\".to_string())\n}\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let llm = ChatOpenAI::new(\"gpt-5.4\")?;\n    let agent = Agent::builder()\n        .with_llm(Arc::new(llm))\n        .tool(get_weather())   // macro generates Arc\u003cdyn Tool\u003e constructor\n        .tool(calculator())\n        .system_prompt(\"You are a helpful assistant.\")\n        .build()?;\n\n    let response = agent.query(\"What's the weather in Tokyo and 15 * 7?\").await?;\n    println!(\"{}\", response);\n    Ok(())\n}\n```\n\nThe macro automatically:\n- Uses the function doc comment as the tool description\n- Maps Rust types to JSON Schema types (`String` → `\"string\"`, `f64` → `\"number\"`, etc.)\n- Uses the attribute key=value pairs as parameter descriptions\n- Generates a zero-arg constructor returning `Arc\u003cdyn Tool\u003e`\n\n### Manual Tool Definition\n\nFor more control, use `FunctionTool` or `ToolBuilder` directly:\n\n```rust,no_run\nuse std::sync::Arc;\nuse agent_io::tools::{ToolBuilder, Tool};\nuse serde::Deserialize;\n\n#[derive(Deserialize)]\nstruct WeatherArgs { location: String }\n\nlet tool: Arc\u003cdyn Tool\u003e = ToolBuilder::new(\"get_weather\")\n    .description(\"Get weather for a location\")\n    .string_param(\"location\", \"The city name\")\n    .build(|args: WeatherArgs| Box::pin(async move {\n        Ok(format!(\"Sunny in {}\", args.location))\n    }));\n```\n\n### Supported Providers\n\n| Provider | Type | Environment Variable |\n|----------|------|---------------------|\n| OpenAI | `ChatOpenAI` | `OPENAI_API_KEY` |\n| Anthropic | `ChatAnthropic` | `ANTHROPIC_API_KEY` |\n| Google Gemini | `ChatGoogle` | `GOOGLE_API_KEY` |\n| DeepSeek | `ChatDeepSeek` | `DEEPSEEK_API_KEY` |\n| Groq | `ChatGroq` | `GROQ_API_KEY` |\n| Mistral | `ChatMistral` | `MISTRAL_API_KEY` |\n| Ollama | `ChatOllama` | — (local) |\n| OpenRouter | `ChatOpenRouter` | `OPENROUTER_API_KEY` |\n| OpenAI-compatible | `ChatOpenAICompatible` | configurable |\n\n## Feature Flags\n\n```toml\n[dependencies.agent-io]\nversion = \"0.3\"\nfeatures = [\"openai\", \"anthropic\", \"google\"]\n# Optional persistent memory backend\n# features = [\"openai\", \"memory-lancedb\"]\n# Or enable the bundled provider set:\n# features = [\"full\"]\n```\n\n## Examples\n\n```bash\n# Basic example (manual tool definition)\ncargo run --example basic\n\n# Macro-based tools (zero boilerplate)\ncargo run --example macro_tools\n\n# Multi-provider\ncargo run --example multi_provider --features full\n```\n\n## Workspace\n\nThis repository is a Cargo workspace:\n\n```\nagent-io/              # main SDK crate\nagent-io-macros/       # proc-macro crate (#[tool])\n```\n\n## License\n\nLicensed under the [Apache License 2.0](agent-io/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flispking%2Fagent-io","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flispking%2Fagent-io","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flispking%2Fagent-io/lists"}