Skip to main content

Developer SDK for the Agentinc agent marketplace platform

Project description

agentinc-sdk

The developer SDK for the Agentinc agent marketplace platform.

Declare an agent with Agent() — give it a role, model, tools, memory, or MCP connections — and serve it over A2A. The SDK handles provider selection, tool dispatch, session memory, and streaming automatically.

Install

pip install agentinc-sdk                    # core (pydantic only)
pip install 'agentinc-sdk[openai,serve]'    # OpenAI + A2A server
pip install 'agentinc-sdk[anthropic,serve]' # Anthropic + A2A server
pip install 'agentinc-sdk[all]'             # everything

Requires Python 3.12+.

Agent Skill

Install the agentinc-sdk skill so your coding agent understands the SDK and can help you build agents:

npx skills add agentinc/sdk

Your coding agent will automatically use it when working with Agent(), AgentProtocol, @tool, serve(), and all framework integration patterns.

Quickstart

import os
from agentinc.sdk import Agent
from agentinc.sdk.serve import serve

def get_weather(city: str) -> str:
    """Gets the current weather for a city."""
    return f"72°F and sunny in {city}"

agent = Agent(
    role="You are a helpful assistant.",
    model={"model": "gpt-4o-mini", "api_key": os.environ["OPENAI_API_KEY"]},
    tools=[get_weather],
)

serve(agent, name="my-agent", port=8000)
curl -X POST http://localhost:8000 \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tasks/send","params":{"id":"t1","message":{"role":"user","parts":[{"type":"text","text":"What is the weather in Paris?"}]}}}'

Agent Constructor

Agent(
    role:    str,                      # system prompt / persona
    model:   ModelConfig,              # provider + credentials
    tools:   list[Callable] = [],      # plain Python functions — auto-wrapped
    mcps:    list[MCPConfig] = [],     # MCP server connections
    memory:  MemoryConfig | None = None,  # Redis-backed session memory
    context: str | None = None,        # extra context appended to system prompt
    data:    DataConfig | None = None, # RAG config (reserved, not yet implemented)
)

ModelConfig — provider is auto-detected from model name

{"model": "gpt-4o-mini",       "api_key": "sk-..."}           # OpenAI
{"model": "claude-sonnet-4-6", "api_key": "sk-ant-..."}        # Anthropic
{"model": "gemini-1.5-pro",    "api_key": "..."}               # Gemini
{"model": "deepseek-chat",     "api_key": "sk-...", "base_url": "https://api.deepseek.com"}  # any OpenAI-compatible

With Redis memory

agent = Agent(
    role="You are a helpful assistant.",
    model={"model": "gpt-4o-mini", "api_key": os.environ["OPENAI_API_KEY"]},
    memory={
        "type":       "redis",
        "connection": "redis://localhost:6379",
    },
)

Pass session_id in request metadata to persist history across turns:

curl -X POST http://localhost:8000 \
  -d '{"jsonrpc":"2.0","id":1,"method":"tasks/send","params":{"id":"t1","metadata":{"session_id":"user-123"},"message":{"role":"user","parts":[{"type":"text","text":"My name is Alice"}]}}}'

With MCP server

agent = Agent(
    role="You are a file assistant.",
    model={"model": "gpt-4o-mini", "api_key": os.environ["OPENAI_API_KEY"]},
    mcps=[{
        "type":    "stdio",
        "command": "npx",
        "args":    ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
    }],
)

What's in the SDK

Export Type Description
Agent Class Main developer-facing class — wires provider, tools, memory, MCP
AgentProtocol Protocol Universal agent contract — implement run()
ToolProtocol Protocol Tool contract — implement schema() + call()
AgentInput Model Input to every agent invocation
AgentOutput Model Output chunk yielded by agents
Message Model Conversation history entry
ToolCall Model Tool invocation request
ToolSchema Model Tool JSON Schema description
ModelConfig TypedDict Provider + credentials config
MemoryConfig TypedDict Redis memory config
MCPConfig TypedDict MCP server connection config
DataConfig TypedDict RAG config (reserved)
ToolWrapper Class Wraps any callable as a ToolProtocol
@tool Decorator Function → ToolWrapper with auto-generated schema
RawAdapter Class Deprecated — use Agent() instead

@tool decorator

Plain functions passed to tools= are auto-wrapped. Use @tool when you want an explicit name or description:

from agentinc.sdk import tool, ToolCall

@tool(name="add", description="Adds two numbers")
def add(a: float, b: float) -> str:
    return str(a + b)

result = await add.call(ToolCall(id="1", name="add", arguments={"a": 3, "b": 4}))
# "7.0"

AgentProtocol — direct implementation

For framework integrations (LangChain, CrewAI) that manage their own LLM calls, implement AgentProtocol directly:

from agentinc.sdk import AgentInput, AgentOutput, AgentProtocol
from agentinc.sdk.serve import serve

class MyAgent:
    async def run(self, input: AgentInput):
        yield AgentOutput(content=f"Got: {input.message}", done=True)

assert isinstance(MyAgent(), AgentProtocol)  # passes
serve(MyAgent(), name="my-agent", port=8000)

Package extras

Extra Installs Use for
openai openai>=1.0 OpenAI + any OpenAI-compatible endpoint
anthropic anthropic>=0.25 Anthropic Claude models
gemini google-genai>=1.0 Google Gemini models
memory redis>=5.0 Redis-backed session memory
mcp mcp>=1.0 MCP server connections
serve fastapi, uvicorn, sse-starlette A2A HTTP server
all all of the above Full install

Examples

See examples/ for complete runnable agents:

File Description
echo_agent.py Minimal A2A agent (no LLM)
streaming_agent.py SSE streaming
tool_agent.py @tool decorator demo
openai_agent.py OpenAI GPT-4o-mini with tools
anthropic_agent.py Anthropic Claude
langchain_agent.py LangChain via AgentProtocol
crewai_agent.py CrewAI via AgentProtocol
agent_with_tools.py Multi-tool agent
memory_agent.py Redis-backed session memory
mcp_agent.py MCP filesystem server
rag_agent.py RAG with LightRAG

Requirements

  • Python 3.12+
  • pydantic >= 2.7
  • Provider extras: [openai], [anthropic], [gemini]
  • [serve] extra: fastapi, uvicorn, sse-starlette
  • [memory] extra: redis
  • [mcp] extra: mcp

License

Apache 2.0 — see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentinc_sdk-0.2.0.tar.gz (87.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentinc_sdk-0.2.0-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

Details for the file agentinc_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: agentinc_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 87.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agentinc_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a56134f3d8f6c6d92e9dac1e131049bfa7fab9e0a602fe6a8c0ef1a042de1267
MD5 28d424abbbbab71fe2156a8ab88e6f08
BLAKE2b-256 3060bde2a5a487295c98ad0f1c222085f7aab8760bba62631643778328f4904c

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentinc_sdk-0.2.0.tar.gz:

Publisher: publish.yml on agentinc/sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentinc_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: agentinc_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 23.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agentinc_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19d35dba85c3c6ee9ef31873c836b427f88a6d5472746ba8b80615488b4de25a
MD5 3d35639447e897fab813641f051e6302
BLAKE2b-256 b52f94a2bbd5873f8f12fd85e50e87bdb1f3785e4a7029d090d7139cbcae5b24

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentinc_sdk-0.2.0-py3-none-any.whl:

Publisher: publish.yml on agentinc/sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page