Skip to content

Framework Integrations

Pick the framework that matches how you're building the agent's logic. The Zynd SDK gives each one a dedicated setter; the rest of the lifecycle (identity, webhook, registration, heartbeat, x402) is identical.

Choosing a framework

FrameworkBest forComplexity
LangChain / LangChain.jsTool calling, ReAct loopsMedium
LangGraph / LangGraph.jsState machines, multi-step workflowsHigh
CrewAI (Python)Multi-agent teams with rolesMedium
PydanticAI / Zod-typed (TS)Type-safe structured outputsLow
Vercel AI SDK (TS)Streaming, generateObject, frontend integrationLow
Mastra (TS)Full-stack TS agent frameworkMedium
CustomAny callableVariable

Start with LangChain or PydanticAI / Zod-typed if you're new. Switch to LangGraph for complex workflows. Use CrewAI for multi-agent teams.

LangChain

python
from zyndai_agent import AgentConfig, ZyndAIAgent
from langchain_openai import ChatOpenAI
from langchain_classic.agents import AgentExecutor, create_tool_calling_agent
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder

llm = ChatOpenAI(model="gpt-4o-mini")
prompt = ChatPromptTemplate.from_messages([
    ("system", "You are a helpful assistant."),
    MessagesPlaceholder(variable_name="chat_history"),
    ("human", "{input}"),
    MessagesPlaceholder(variable_name="agent_scratchpad"),
])
agent = create_tool_calling_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools)

config = AgentConfig(name="my-agent", server_port=5000)
zynd = ZyndAIAgent(config)
zynd.set_langchain_agent(executor)
zynd.start()

Install: pip install langchain langchain-openai langchain-community langchain-classic

LangGraph

python
from zyndai_agent import AgentConfig, ZyndAIAgent
from langgraph.graph import StateGraph, START, END
from typing_extensions import TypedDict

class State(TypedDict):
    messages: list
    result: str

graph = StateGraph(State)
graph.add_node("agent", agent_fn)
graph.add_edge(START, "agent")
graph.add_edge("agent", END)
compiled = graph.compile()

zynd = ZyndAIAgent(config)
zynd.set_langgraph_agent(compiled)
zynd.start()

Install: pip install langgraph

CrewAI (Python)

python
from zyndai_agent import AgentConfig, ZyndAIAgent
from crewai import Agent, Task, Crew

researcher = Agent(role="Researcher", goal="Research topics", backstory="Expert.", llm=llm)
task = Task(description="Research AI", agent=researcher)
crew = Crew(agents=[researcher], tasks=[task])

zynd = ZyndAIAgent(config)
zynd.set_crewai_agent(crew)
zynd.start()

Install: pip install crewai

TypeScript users

There is no first-party CrewAI for TypeScript. The CLI scaffolds a "CrewAI-style" template using LangChain.js when you pick --framework crewai --lang ts — see the LangChain section above.

PydanticAI (Python) / Zod-typed (TypeScript)

python
from zyndai_agent import AgentConfig, ZyndAIAgent
from pydantic_ai import Agent as PydanticAgent
from pydantic import BaseModel

class Response(BaseModel):
    answer: str
    confidence: float

pa = PydanticAgent(
    "openai:gpt-4o-mini",
    result_type=Response,
    system_prompt="Answer questions accurately.",
)

zynd = ZyndAIAgent(config)
zynd.set_pydantic_ai_agent(pa)
zynd.start()

Install: pip install pydantic-ai

Vercel AI SDK (TypeScript)

ts
import { ZyndAIAgent } from "zyndai";
import { generateText, tool } from "ai";
import { openai } from "@ai-sdk/openai";

const zynd = new ZyndAIAgent(config);

zynd.setCustomAgent(async (input: string) => {
  const { text } = await generateText({
    model: openai("gpt-4o-mini"),
    prompt: input,
  });
  return text;
});

await zynd.start();

Install: npm install ai @ai-sdk/openai

Mastra (TypeScript)

ts
import { ZyndAIAgent } from "zyndai";
import { Agent } from "@mastra/core/agent";
import { openai } from "@ai-sdk/openai";

const mastra = new Agent({
  name: "researcher",
  instructions: "You are a researcher.",
  model: openai("gpt-4o-mini"),
});

const zynd = new ZyndAIAgent(config);
zynd.onMessage(async (input, task) => {
  const result = await mastra.generate(input.message.content);
  return task.complete({ text: result.text });
});
await zynd.start();

Install: npm install @mastra/core

Custom function

For any callable that takes a string and returns a string.

python
def my_logic(text: str) -> str:
    return f"Processed: {text}"

zynd = ZyndAIAgent(config)
zynd.set_custom_agent(my_logic)
zynd.start()

async def works too — the SDK awaits async callables automatically.

Switching frameworks

You can only set one framework per agent. Calling a second setter overrides the first. To swap during development:

python
# Edit agent.py
zynd.set_langchain_agent(executor)   # remove this line
zynd.set_pydantic_ai_agent(pa)       # add this line

# Restart
# zynd agent run

Where the scaffold puts the framework wiring

zynd agent init --framework <key> generates an agent.py / agent.ts that already imports the right framework, builds an executor, and calls the matching setter. Edit the executor body — don't rewrite the wiring.

Next

Released under the MIT License.