AI Agent API

AI Agent API — build intelligent agents with tools, RAG, and 30+ models

Build production AI agents with one OpenAI-compatible API. Function calling, tool integration, RAG pipelines, sub-agents, and streaming — across 30+ models from DeepSeek to Llama to Mistral.

An AI agent is an LLM-powered system that reasons about a goal, decides which tools to call, executes them, and iterates until the task is complete. Plugsky's AI Agent API gives you the full stack — function calling, tool execution, RAG context injection, sub-agent orchestration, and dynamic model switching — behind a single OpenAI-compatible endpoint.

What is an AI Agent API?

An AI Agent API is an endpoint that lets you build autonomous agents with function calling, tool use, RAG, and multi-step reasoning — without stitching together separate services for each capability.

Unlike basic chat APIs that return text from a single model call, an agent API supports:

  • Function calling — the model requests tool invocations, your code executes them, results flow back into the conversation loop
  • Tool integration — wire in web search, databases, APIs, file systems, or custom business logic
  • Context management — maintain conversation history, tool outputs, and agent state across multiple turns
  • Dynamic model switching — route simple lookups to a fast cheap model and complex reasoning to a frontier model in the same agent run

Plugsky collapses these primitives into one HTTP API. You don't need a separate vector DB for RAG, a separate function-calling layer, or a separate orchestration runtime. One base_url change and your agent works across 30+ models.

Why build agents with Plugsky?

  1. One API for 30+ models — swap between DeepSeek, Llama, Mistral, Qwen, and Plugsky's own models by changing a string. No code changes, no new SDKs, no vendor lock-in. If one model is down or too slow, switch to another in the same request.
  2. OpenAI-compatible — use any OpenAI SDK (Python, Node, Go, Rust, Ruby) or any framework that speaks the OpenAI shape (LangChain, LlamaIndex, Vercel AI SDK). Point base_url at https://api.plugsky.com/v1 and your agent code runs unchanged.
  3. Built-in function calling with JSON Schema — define tools as JSON Schema objects. Every model supports parallel function calls, tool_choice, strict mode, and nested parameter schemas. No adapter layer needed.
  4. RAG pipeline without vector DB setup — upload documents, Plugsky chunks, embeds, and indexes them automatically. Query with /v1/rag/query, get ranked chunks with citations. No Pinecone, no Weaviate, no Qdrant to manage.
  5. Sovereign deployment option — for data-sensitive agents, deploy Plugsky inside your VPC or on-prem. Your agent's tool calls, context, and knowledge never leave your infrastructure. Available on Enterprise tier.

Key capabilities

Function calling

Function calling (tool use) is the core primitive of any agent. You define tools as JSON Schema objects, send them with every request, and the model decides which tool to call, when, and with what arguments. Your code executes the tool and feeds the result back into the conversation.

python
tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Get current weather for a city",
        "parameters": {
            "type": "object",
            "properties": {"city": {"type": "string"}},
            "required": ["city"]
        }
    }
}]

resp = client.chat.completions.create(
    model="plugsky-pro",
    messages=[{"role":"user","content":"What's the weather in Dubai?"}],
    tools=tools,
)

# Response:
# {
#   "choices": [{
#     "message": {
#       "tool_calls": [{
#         "function": {
#           "name": "get_weather",
#           "arguments": "{\"city\": \"Dubai\"}"
#         }
#       }]
#     }
#   }]
# }

The model returns structured tool calls. Your code executes get_weather(city="Dubai"), sends the result back as a tool role message, and the agent continues. Supports parallel calls — the model can request multiple tools in one response, and your code dispatches them concurrently.

Multi-agent orchestration

Complex tasks benefit from multiple specialized agents working together. Plugsky supports sub-agent spawning, task delegation, and parallel execution through the chat completions API. An orchestrator agent can delegate research to a search specialist, analysis to a reasoning agent, and writing to a content agent — all sharing context and tool access.

Sub-agents run as independent chat completions calls with their own system prompt, tools, and model selection. Results flow back to the orchestrator for synthesis. This pattern scales from two-agent pairs to teams of ten or more specialists.

RAG integration

Plugsky's RAG API is built into the agent stack. Upload documents to a collection, query with natural language, and get ranked chunks with source citations. Feed those chunks into your agent's context for grounded, verifiable answers.

python
# 1. Create a RAG collection
collection = client.rag.collections.create(name="policy-docs")

# 2. Upload knowledge base
client.rag.documents.create(
    collection_id=collection.id,
    file=open("employee-handbook.pdf", "rb"),
)

# 3. Agent queries RAG at runtime
def agent_loop(user_msg):
    ctx = client.rag.query.create(
        collection_id=collection.id,
        query=user_msg,
        top_k=5,
    )
    context = "\n".join(c.text for c in ctx.chunks)
    messages = [
        {"role":"system","content":f"Context:\n{context}"},
        {"role":"user","content":user_msg},
    ]
    return client.chat.completions.create(
        model="plugsky-pro",
        messages=messages,
        tools=tools,
    )

No vector DB to configure. No embedding pipelines to maintain. No chunking strategy to tune. Plugsky handles the full RAG lifecycle — chunking, embedding, indexing, retrieval, and reranking — inside the agent call.

Streaming

Set stream: true on any chat completions call and Plugsky sends server-sent events (SSE) as the model generates. Streaming works with function calling — tool calls arrive as events alongside text tokens. This means agent steps, intermediate reasoning, and final output all stream in real time to your UI.

Model routing

Not every agent step needs a frontier model. Plugsky lets you select different models for different stages of an agent run:

  • Simple tool lookups — route to plugsky-micro or plugsky-lite (fast, cheap)
  • Reasoning and planning — route to plugsky-pro or plugsky-frontier (deep reasoning)
  • RAG context synthesis — route to plugsky-plus (balanced quality/speed)

Dynamic model routing reduces cost by 40-60% compared to running every step on a single frontier model.

Supported models for agents

ModelBest use case
plugsky-microSimple tool use, classification, data extraction — fastest response, lowest latency
plugsky-liteFast agents, high-throughput tool calls, conversational agents
plugsky-plusComplex reasoning, multi-step planning, RAG-rich agents
plugsky-proProduction agents, reliable function calling, enterprise workloads
plugsky-frontierResearch agents, deep analysis, cutting-edge reasoning benchmarks

All models support the same tools array, streaming, and JSON mode. Swap models with a single string change. No code changes, no new endpoints.

Code example

Here's a complete Python agent that uses web search and file writing tools — running on Plugsky via the OpenAI SDK:

python
from openai import OpenAI
import json

client = OpenAI(
    base_url="https://api.plugsky.com/v1",
    api_key="sk-live-...",
)

tools = [
    {
        "type": "function",
        "function": {
            "name": "web_search",
            "description": "Search the web for current information",
            "parameters": {
                "type": "object",
                "properties": {
                    "query": {"type": "string"}
                },
                "required": ["query"]
            }
        }
    },
    {
        "type": "function",
        "function": {
            "name": "write_file",
            "description": "Write content to a file",
            "parameters": {
                "type": "object",
                "properties": {
                    "path": {"type": "string"},
                    "content": {"type": "string"}
                },
                "required": ["path", "content"]
            }
        }
    }
]

def agent(user_input):
    messages = [{"role": "user", "content": user_input}]
    for step in range(10):
        r = client.chat.completions.create(
            model="plugsky-pro",
            messages=messages,
            tools=tools,
        )
        msg = r.choices[0].message
        if not msg.tool_calls:
            return msg.content
        messages.append(msg)
        for tc in msg.tool_calls:
            fn = tc.function.name
            args = json.loads(tc.function.arguments)
            if fn == "web_search":
                result = search_web(args["query"])
            elif fn == "write_file":
                result = save_file(args["path"], args["content"])
            messages.append({
                "role": "tool",
                "tool_call_id": tc.id,
                "content": json.dumps(result)
            })
    return "Max steps reached"

result = agent(
    "Search for the latest AI agent frameworks, "
    "then save a summary to agent-frameworks.md"
)
print(result)

Agent pricing

Plugsky uses flat-rate pricing — one monthly fee covers unlimited agent runs. No per-token metering, no surprise bills from runaway agent loops, no cost anxiety when your agent iterates 10 steps instead of 3.

FactorPlugsky (managed API)Self-hosting (DIY)
Pricing modelFlat monthly — unlimited API requestsGPU compute + per-token inference cost
Model access30+ models, swap instantly1-2 models (limited by VRAM budget)
Function callingBuilt-in, all modelsMust implement or use open-source framework
RAG pipelineManaged — upload and queryVector DB + embedder + retriever (Pinecone, Weaviate, etc.)
ScalabilityAuto-scales to millions of requestsMust provision GPU clusters, handle failover
MaintenanceZero — API always up to dateModel updates, security patches, uptime monitoring
Monthly cost (est.)$7–$249 (all-inclusive)$500–$5,000+ (GPU + infra + ops)

For teams building production agents, the choice is clear: pay Plugsky a flat fee and ship in days, or self-host infrastructure and spend months on ops. The build-vs-buy calculus heavily favors the managed API when you factor in engineering time, model diversity, and operational overhead.

When to use Plugsky for agents

  • Production agents needing reliability — Plugsky handles failover across 30+ models. If one model degrades, your agent automatically routes to another. Uptime SLA available on paid plans.
  • Teams wanting multi-model flexibility — build once, run on any model. Test your agent on plugsky-frontier, deploy on plugsky-pro, and fall back to plugsky-lite during cost sensitivity — all with a string change.
  • Data-sensitive use cases needing sovereign deployment — Enterprise tier keeps your agent's tool calls, context, and RAG knowledge inside your VPC or data center. Compliant with GDPR, PDPL, and industry-specific regulations.
  • Startups wanting predictable costs — flat pricing means you know what you'll pay each month. No per-token shock from a long agent run. Free tier for prototyping, then scale to paid when you're ready.

Limitations

Plugsky's AI Agent API is a managed runtime — not a framework. Consider alternatives if:

  • You need pre-built agent frameworks — LangGraph, CrewAI, AutoGen, and Semantic Kernel provide higher-level abstractions (graph-based workflows, role-based teams, persistent agent memory). Plugsky works great as the LLM backend for these frameworks via its OpenAI compatibility.
  • You need specialized agent hosting platforms — platforms like Relevance AI, Vellum, or LangSmith provide end-to-end agent building UIs with no-code editors, evaluation suites, and human-in-the-loop approval flows. Plugsky focuses on the API layer.
  • You need fine-tuning for agent behavior — Plugsky does not currently offer fine-tuning on agent-specific datasets. If you need a model trained specifically on your tool-calling patterns, providers like Together AI or Fireworks offer fine-tuning alongside inference.

For most agent use cases — tool-use agents, RAG-augmented agents, multi-step research, customer support automation — Plugsky's API is the fastest path to production.

Frequently asked questions

Is Plugsky compatible with LangChain and CrewAI?

Yes. Both LangChain and CrewAI speak the OpenAI function-calling shape, so they work with Plugsky via a base_url change. Point them at https://api.plugsky.com/v1 and your existing agent code runs against 30+ models.

Do you support function calling?

Yes. Every Plugsky chat model supports the OpenAI tools array. Define tools in JSON Schema, the model returns structured tool calls, your code executes them. Supports parallel calls, tool_choice, and strict mode.

Can I build multi-agent systems?

Yes. Plugsky supports sub-agents, task delegation, and parallel execution. Use the Agent Runs endpoint or build your own orchestrator with the chat completions API. Multiple agents can share memory and tool access.

Does Plugsky support streaming for agents?

Yes. Set stream: true on any chat completions call and you get server-sent events (SSE) as the model generates. Agent steps, tool calls, and final output all stream in real time.

What's the free tier for agent development?

Plugsky's free tier gives you unlimited API requests to plugsky-micro and plugsky-lite models — perfect for prototyping agents. No credit card required. Paid plans start at $7/mo for plugsky-pro and higher.

Build your first agent

Function calling, RAG, sub-agents, streaming — in one OpenAI-compatible API across 30+ models.

Start Free → Open the agent builder