Skip to main content

Python SDK for SAMVAD — The Open Sovereign Agent Dialogue Protocol

Project description

samvad — Python SDK

Python SDK for the SAMVAD protocol (v1.2) — RFC 9421 HTTP signatures, Ed25519 keys, Pydantic v2, async-first.

Install

pip install samvad

Quick start

import asyncio
from pydantic import BaseModel
from samvad import Agent, SkillContext


class EchoIn(BaseModel):
    text: str


class EchoOut(BaseModel):
    echoed: str


async def echo(p: EchoIn, ctx: SkillContext) -> EchoOut:
    return EchoOut(echoed=p.text)


agent = (
    Agent(
        name="my-agent",
        description="My first SAMVAD agent",
        url="http://localhost:3003",
        specializations=["demo"],
        models=[],
    )
    .skill(
        name="echo",
        description="Echoes input text",
        input_schema=EchoIn,
        output_schema=EchoOut,
        modes=["sync"],
        trust="public",
        handler=echo,
    )
)

# ASGI app (use with uvicorn, Starlette, etc.)
app = agent.build_app()

# Or run directly:
if __name__ == "__main__":
    asyncio.run(agent.serve(host="0.0.0.0", port=3003))
uvicorn main:app --port 3003
curl http://localhost:3003/.well-known/agent.json | jq .

Calling another agent

from samvad import AgentClient

async def main():
    client = await AgentClient.from_url("http://localhost:3002")
    result = await client.call("echo", {"text": "hello"})
    print(result)  # {"echoed": "hello"}

Requirements

  • Python 3.10+
  • Dependencies: cryptography, pydantic>=2.5, httpx, starlette, sse-starlette, pyjwt[crypto]

Links

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

samvad-0.2.0.tar.gz (41.0 kB view details)

Uploaded Source

Built Distribution

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

samvad-0.2.0-py3-none-any.whl (26.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: samvad-0.2.0.tar.gz
  • Upload date:
  • Size: 41.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for samvad-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9baa2a8e1922b7d8680e1a3695cce6a58dff4157e48debfad6ad0d712e79e1f2
MD5 9179acd57eeb65468467c8608c6a304c
BLAKE2b-256 9ccb17e055c6cda9957598878ae8b2512e293c25133f3ad319d92304af735aad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: samvad-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 26.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for samvad-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0568c5bdf6fae791b1595449280d24ed9d32fa00f891ed0c0b9c7be783982d8f
MD5 5d8dc85e666d7d3a01b17ef0c1dc4aff
BLAKE2b-256 6f841746e3c4ad5ff8cf81a599889f4c09ea000369aefbf945ead49b538b64f3

See more details on using hashes here.

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