|
| 1 | +# Agent Stack Client SDK |
| 2 | + |
| 3 | +TypeScript/JavaScript client SDK for building applications that interact with Agent Stack agents. |
| 4 | + |
| 5 | +[](https://www.npmjs.com/package/agentstack-sdk) |
| 6 | +[](https://opensource.org/licenses/Apache-2.0) |
| 7 | +[](https://lfaidata.foundation/projects/) |
| 8 | + |
| 9 | +## Overview |
| 10 | + |
| 11 | +The `agentstack-sdk` provides TypeScript/JavaScript tools for building client applications that communicate with agents deployed on Agent Stack. It includes utilities for handling the A2A (Agent-to-Agent) protocol, managing agent extensions, and working with the Agent Stack platform API. |
| 12 | + |
| 13 | +## Key Features |
| 14 | + |
| 15 | +- **A2A Protocol Support** - Full support for Agent-to-Agent communication |
| 16 | +- **Extension System** - Built-in handlers for forms, OAuth, LLM services, MCP, and more |
| 17 | +- **Platform API Client** - Utilities for context and token management |
| 18 | +- **TypeScript Types** - Comprehensive types for all APIs |
| 19 | + |
| 20 | +## Installation |
| 21 | + |
| 22 | +```bash |
| 23 | +npm install agentstack-sdk |
| 24 | +``` |
| 25 | + |
| 26 | +## Quickstart |
| 27 | + |
| 28 | +```typescript |
| 29 | +import { handleAgentCard, handleTaskStatusUpdate, TaskStatusUpdateType } from 'agentstack-sdk'; |
| 30 | + |
| 31 | +// Parse agent capabilities |
| 32 | +const { extensions, fulfillments } = await handleAgentCard(agentCard); |
| 33 | + |
| 34 | +// Send message and handle responses |
| 35 | +const stream = client.sendMessage(message); |
| 36 | + |
| 37 | +for await (const event of stream) { |
| 38 | + const result = handleTaskStatusUpdate(event); |
| 39 | + |
| 40 | + switch (result.type) { |
| 41 | + case TaskStatusUpdateType.Message: |
| 42 | + console.log('Agent response:', result.message.parts[0].text); |
| 43 | + break; |
| 44 | + case TaskStatusUpdateType.InputRequired: |
| 45 | + // Handle extension demands (forms, OAuth, etc.) |
| 46 | + break; |
| 47 | + } |
| 48 | +} |
| 49 | +``` |
| 50 | + |
| 51 | +## Available Extensions |
| 52 | + |
| 53 | +The SDK includes clients and specs for handling: |
| 54 | + |
| 55 | +- **Forms** - Static and dynamic form handling (`FormExtensionClient`, `FormExtensionSpec`) |
| 56 | +- **OAuth** - Authentication flows (`OAuthExtensionClient`, `OAuthExtensionSpec`) |
| 57 | +- **LLM Services** - Model access and credentials (`LLMServiceExtensionClient`, `buildLLMExtensionFulfillmentResolver`) |
| 58 | +- **Platform API** - Context and resource access (`PlatformApiExtensionClient`, `buildApiClient`) |
| 59 | +- **MCP** - Model Context Protocol integration (`MCPServiceExtensionClient`) |
| 60 | +- **Embeddings** - Vector embedding services (`EmbeddingServiceExtensionClient`) |
| 61 | +- **Secrets** - Secure credential management (`SecretsExtensionClient`) |
| 62 | +- **Citations** - Source attribution (`citationExtension`) |
| 63 | +- **Agent Details** - Metadata and UI enhancements (`AgentDetailExtensionSpec`) |
| 64 | + |
| 65 | +Each extension has a corresponding `ExtensionClient` for sending data and `ExtensionSpec` for parsing agent cards. |
| 66 | + |
| 67 | +## Resources |
| 68 | + |
| 69 | +- [Agent Stack Documentation](https://agentstack.beeai.dev) |
| 70 | +- [GitHub Repository](https://github.com/i-am-bee/agentstack) |
| 71 | +- [npm Package](https://www.npmjs.com/package/agentstack-sdk) |
| 72 | + |
| 73 | +## Contributing |
| 74 | + |
| 75 | +Contributions are welcome! Please see the [Contributing Guide](https://github.com/i-am-bee/agentstack/blob/main/CONTRIBUTING.md) for details. |
| 76 | + |
| 77 | +## Support |
| 78 | + |
| 79 | +- [GitHub Issues](https://github.com/i-am-bee/agentstack/issues) |
| 80 | +- [GitHub Discussions](https://github.com/i-am-bee/agentstack/discussions) |
| 81 | + |
| 82 | +--- |
| 83 | + |
| 84 | +Developed by contributors to the BeeAI project, this initiative is part of the [Linux Foundation AI & Data program](https://lfaidata.foundation/projects/). Its development follows open, collaborative, and community-driven practices. |
0 commit comments