Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added agent_suite_sdk/__init__.py
Empty file.
47 changes: 47 additions & 0 deletions agent_suite_sdk/client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import httpx
from typing import List, Optional
from .schemas import InboxResponse, InboxPublic, MessageCreate, MessageList

class AgentSuiteClient:
def __init__(self, api_key: Optional[str] = None, base_url: str = "http://localhost:8000"):
self.base_url = base_url
self.headers = {"Authorization": f"Bearer {api_key}"} if api_key else {}
self.client = httpx.AsyncClient(base_url=self.base_url, headers=self.headers)

async def create_inbox(self) -> InboxResponse:
"""Creates a new inbox and returns the API Key."""
response = await self.client.post("/v1/inboxes")
response.raise_for_status()
data = response.json()
# Update headers if we just created the account
self.client.headers.update({"Authorization": f"Bearer {data['api_key']}"})
return InboxResponse(**data)

async def get_my_inbox(self) -> InboxPublic:
"""Gets current inbox details."""
response = await self.client.get("/v1/inboxes/me")
response.raise_for_status()
return InboxPublic(**response.json())

async def send_email(self, to: str, subject: str, body: str, html_body: Optional[str] = None):
"""Sends an email."""
payload = {
"to": to,
"subject": subject,
"body": body,
"html_body": html_body
}
response = await self.client.post("/v1/inboxes/me/send", json=payload)
response.raise_for_status()
return response.json()

async def list_messages(self, skip: int = 0, limit: int = 50, unread_only: bool = False) -> MessageList:
"""Lists received messages."""
params = {"skip": skip, "limit": limit, "unread_only": unread_only}
response = await self.client.get("/v1/inboxes/me/messages", params=params)
response.raise_for_status()
return MessageList(**response.json())

async def close(self):
"""Closes the client connection."""
await self.client.aclose()
34 changes: 34 additions & 0 deletions agent_suite_sdk/schemas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from pydantic import BaseModel, EmailStr
from uuid import UUID
from datetime import datetime
from typing import List, Optional

class InboxResponse(BaseModel):
id: UUID
email_address: str
api_key: str
created_at: datetime

class InboxPublic(BaseModel):
id: UUID
email_address: str
created_at: datetime

class MessageCreate(BaseModel):
to: EmailStr
subject: str
body: str
html_body: Optional[str] = None

class MessageResponse(BaseModel):
id: UUID
sender: str
recipient: str
subject: Optional[str]
body_text: Optional[str]
received_at: datetime
is_read: bool

class MessageList(BaseModel):
total: int
messages: List[MessageResponse]
34 changes: 34 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
openapi: 3.0.0
info:
title: Agent Suite API
version: 0.1.0
description: Infrastructure API for AI agents (Email without OAuth)
servers:
- url: http://localhost:8000
paths:
/v1/inboxes:
post:
summary: Create new inbox
responses:
'201':
description: Created
/v1/inboxes/me/send:
post:
summary: Send Email
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
to: {type: string}
subject: {type: string}
body: {type: string}
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer