Async Python SDK for the Persona AI platform
Project description
persona-sdk-python
Async Python SDK for the Persona AI platform.
Installation
pip install persona-sdk-python
Or with uv:
uv add persona-sdk-python
Requirements: Python 3.10+
Quick start
import asyncio
from persona_sdk import PersonaSdk
async def main():
sdk = PersonaSdk(
base_url="https://persona.applica.guru/api",
auth="prs_your_project_api_key",
)
# List agents in your project
agents = await sdk.agents.list()
print(agents)
await sdk.close()
asyncio.run(main())
Authentication
The SDK supports two authentication methods via the auth parameter.
API key (default)
A plain string is wrapped automatically in ApiKeyAuthenticationProvider and
sent as the x-persona-apikey header. Accepts:
- Master key (full admin access)
- Project API key (
prs_...) - Agent API key (
prs_ag_...)
from persona_sdk import PersonaSdk
sdk = PersonaSdk(
base_url="https://persona.applica.guru/api",
auth="prs_your_project_api_key",
)
IAM Bearer token
For applications that authenticate users via IAM, pass a
BearerTokenAuthenticationProvider with a valid JWT:
from persona_sdk import PersonaSdk, BearerTokenAuthenticationProvider
sdk = PersonaSdk(
base_url="https://persona.applica.guru/api",
auth=BearerTokenAuthenticationProvider(iam_jwt_token),
)
The token is sent as the Authorization: Bearer <token> header. The server
validates it via the IAM service and resolves the user's project automatically.
Custom provider
Implement your own provider by subclassing AuthenticationProvider:
from persona_sdk import AuthenticationProvider
class MyProvider(AuthenticationProvider):
def headers(self) -> dict[str, str]:
return {"x-custom-header": "value"}
def credentials(self) -> str:
return "my-credentials"
Available APIs
The PersonaSdk instance exposes one client per resource:
| Attribute | Description |
|---|---|
sdk.agents |
Agent management (CRUD, voices) |
sdk.projects |
Project management and subscriptions |
sdk.sessions |
Sessions, messages, usage |
sdk.knowledge_bases |
Knowledge bases, documents, chunk search |
sdk.workflows |
Workflows, executions, queues |
sdk.triggers |
Triggers and trigger executions |
sdk.missions |
Missions (generate, execute, stop, continue) |
sdk.features |
Feature templates and MCP tools |
sdk.credentials |
OAuth credentials and authorization |
sdk.service_prices |
Service pricing |
Each API method is fully async. Always close the SDK when done:
sdk = PersonaSdk(...)
try:
agents = await sdk.agents.list()
finally:
await sdk.close()
Or use it as an async context manager pattern:
sdk = PersonaSdk(...)
async with sdk.client._client: # internal httpx client
...
CRUD example
# Create an agent
agent = await sdk.agents.create({
"name": "my-agent",
"model": {"modelName": "gpt-4o"},
})
# Read
fetched = await sdk.agents.get(agent["id"])
# Update
fetched["name"] = "renamed-agent"
await sdk.agents.update(agent["id"], fetched)
# Delete
await sdk.agents.delete(agent["id"])
Pagination
List endpoints accept keyword, page, and size:
result = await sdk.agents.list(keyword="bot", page=1, size=20)
# {
# "items": [...],
# "total": 42,
# "page": 1,
# "size": 20
# }
Workflows
If your workflows service runs on a different host, pass workflows_url:
sdk = PersonaSdk(
base_url="https://persona.applica.guru/api",
auth="prs_...",
workflows_url="https://persona.applica.guru/workflows",
)
# Execute a workflow
result = await sdk.workflows.execute(
workflow_id="wf-123",
data={"input": "value"},
)
Runners
For higher-level abstractions, the SDK provides runners:
from persona_sdk import PersonaClient
from persona_sdk.runners import AgentRunner, invoke_tool, retrieve_resource
client = PersonaClient(
base_url="https://persona.applica.guru/api",
auth="prs_...",
)
# Run an agent in an existing session
runner = AgentRunner(client=client, agent_id="agent-1", session_code="sess-1")
response = await runner.run("Hello, agent!")
# Invoke an MCP tool directly
result = await invoke_tool(
client=client,
mcp_server_name="my-mcp",
transport=...,
tool_name="search",
args={"query": "hello"},
)
Proxy support
sdk = PersonaSdk(
base_url="https://persona.applica.guru/api",
auth="prs_...",
proxy="http://proxy.local:8080",
)
License
Proprietary — © Applica Software Guru
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file persona_sdk_python-0.2.4.tar.gz.
File metadata
- Download URL: persona_sdk_python-0.2.4.tar.gz
- Upload date:
- Size: 23.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50ca394ff8fb2094c7b87be799d760bf8f5fcded89c49a65d5878eef78427af1
|
|
| MD5 |
f09532da42a108b6c5a47050d9a54bde
|
|
| BLAKE2b-256 |
b06e50348d3e52161810820a4b3dc2874285bbc2bab20ddafcc1738d89c3d66d
|
File details
Details for the file persona_sdk_python-0.2.4-py3-none-any.whl.
File metadata
- Download URL: persona_sdk_python-0.2.4-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21324719993ee84272246d69e8e7d1bda5857fa9a88cb3ca3d93d3dae8d97410
|
|
| MD5 |
ec99f6075f18567daed62f1c74e26702
|
|
| BLAKE2b-256 |
492b467b66d9c1e10e89c0563bb19daa81f5e1f773689bb258a4f8e58b3d4290
|