Skip to content

astropods/adapters

Repository files navigation

Astropods Adapters

Astro is a platform-agnostic deployment platform for AI agents — it doesn't care which framework or model you use. Adapters are the bridge between your agent and the Astro runtime: they implement a thin interface that lets Astro handle messaging, streaming, voice, and observability without requiring any changes to your agent code. You keep your framework; Astro handles the infrastructure.

Packages

Package Description
@astropods/adapter-core Framework-agnostic AgentAdapter interface and MessagingBridge that connects any adapter to the Astro messaging gRPC service.
@astropods/adapter-mastra Mastra-specific adapter. Wraps a Mastra Agent and translates its fullStream chunks into the StreamHooks lifecycle, including voice (STT + TTS) support.
@astropods/adapter-ai-sdk Vercel AI SDK adapter. Serves an Experimental_Agent over messaging and exposes astroTelemetry() to wire experimental_telemetry to Astro's OTLP exporter.
@astropods/adapter-langchain LangChain.js adapter. Serves a createAgent/createReactAgent agent over messaging and exposes instrumentLangChain() for OpenTelemetry tracing.
@astropods/adapter-claude-agent-sdk Drop-in replacement for @anthropic-ai/claude-agent-sdk that adds OpenTelemetry instrumentation.

Quick start

Install the adapter for your framework:

# Mastra
bun add @astropods/adapter-mastra

Connect your agent:

import { Agent } from '@mastra/core/agent';
import { serve } from '@astropods/adapter-mastra';

const agent = new Agent({
  name: 'My Agent',
  instructions: 'You are a helpful assistant.',
  model: 'openai/gpt-4o',
});

serve(agent);

Custom adapters

Implement AgentAdapter from @astropods/adapter-core (TS) or astropods-adapter-core (Python) to connect any agent framework:

import { serve } from '@astropods/adapter-core';
import type { AgentAdapter } from '@astropods/adapter-core';

const adapter: AgentAdapter = {
  name: 'My Agent',
  async stream(prompt, hooks, options) {
    // options.platformContext exposes channel, thread, workspace, eventKind, etc.
    // when the message originated from a platform adapter (Slack, Discord, web).
    hooks.onChunk('Hello!');
    hooks.onFinish();
  },
  getConfig() { return { systemPrompt: '', tools: [] }; },
};

serve(adapter);

See packages/core (TypeScript) or packages/core-py (Python) for the full interface, including how to use PlatformContext to branch on the source event (DM vs @-mention vs thread reply) and reply back into the right channel and thread.

Contributing

We welcome adapters for any agent framework. If you've built an agent with LangChain, CrewAI, or anything else, we'd love a contribution. Open a pull request or file an issue to get started.

About

Agent adapters for Astropods

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors