Soorma Common
Common models and DTOs shared across Soorma platform services.
Installation
pip install -e .
Usage
from soorma_common.models import (
AgentDefinition,
AgentCapability,
EventDefinition,
SemanticMemoryCreate,
EpisodicMemoryCreate,
WorkingMemorySet,
)
# Create an agent definition (v0.8.1+: consumed_event and produced_events require EventDefinition objects)
agent = AgentDefinition(
agent_id="my-agent",
name="My Agent",
description="A sample agent",
capabilities=[
AgentCapability(
task_name="process_data",
description="Process incoming data",
consumed_event=EventDefinition(
event_name="data.received",
topic="action-requests",
description="Incoming data event"
),
produced_events=[
EventDefinition(
event_name="data.processed",
topic="action-results",
description="Successfully processed data"
),
EventDefinition(
event_name="data.error",
topic="action-results",
description="Data processing error"
),
]
)
]
)
# Create semantic memory (knowledge storage)
semantic = SemanticMemoryCreate(
agent_id="researcher",
content="Python is a high-level programming language",
metadata={"category": "programming", "source": "textbook"}
)
# Create episodic memory (interaction history)
episodic = EpisodicMemoryCreate(
agent_id="assistant",
role="user",
content="What is the weather like today?",
metadata={"session_id": "abc-123"}
)
# Create working memory (plan state)
working = WorkingMemorySet(
value={"current_step": 2, "total_steps": 5, "status": "in_progress"}
)
Models
Agent Registry
AgentCapability- Describes a single capability or task an agent can performAgentDefinition- Defines a single agent in the systemAgentRegistrationRequest- Request to register a new agentAgentRegistrationResponse- Response after registering an agentAgentQueryRequest- Request to query agentsAgentQueryResponse- Response containing agent definitionsDiscoveredAgent- Agent discovery result; includes fullAgentCapabilitylist withget_consumed_schemas()/get_produced_schemas()helpers
Schema Registry (v0.8.1+)
PayloadSchema- Schema definition with semantic versioning (schema_name,version,json_schema)PayloadSchemaRegistration- Request to register a new schema (body; auth headers provide tenant/user)PayloadSchemaResponse- Registration response withschema_name,version,success,messagePayloadSchemaRegistrationRequest- Envelope wrappingPayloadSchemainschemakeyPayloadSchemaListResponse- Response containing a list ofPayloadSchemaentries
Event Registry
EventDefinition- Defines a single event in the system (v0.8.1+: addpayload_schema_name/response_schema_namefor Schema Registry references)EventRegistrationRequest- Request to register a new eventEventRegistrationResponse- Response after registering an eventEventQueryRequest- Request to query eventsEventQueryResponse- Response containing event definitions
A2A (Agent-to-Agent Protocol, v0.8.1+)
Import from
soorma_common.a2a
A2AAgentCard- Agent capability advertisement card (name, description, URL, skills)A2ASkill- Individual skill entry advertised in an agent cardA2AAuthentication- Authentication descriptor for an A2A agent cardA2ATask- A2A task representation (id, messages, current status)A2ATaskStatus- Enum:submitted,working,completed,failed,canceledA2AMessage- Message in an A2A task conversation (role + parts)A2APart- Content part of an A2A message (textordata)A2ATaskResponse- Response payload returned from an A2A task handlerA2AAuthType- Enum:none,bearer_token,api_key
Memory Service (CoALA Framework)
The Memory Service implements the CoALA (Cognitive Architectures for Language Agents) framework with four memory types:
Authentication Note: Memory Service supports dual authentication:
- JWT Token (User sessions): Provides
tenant_id+user_idfrom token- API Key (Agent operations): Provides
tenant_id+agent_id, requires explicituser_idin request parametersSee Memory Service SDK documentation for details.
Semantic Memory (Knowledge Base)
SemanticMemoryCreate- Add knowledge to semantic memorySemanticMemoryResponse- Semantic memory entry with similarity score- Use cases: Store facts, documentation, learned information
- Features: Vector search, RAG (Retrieval-Augmented Generation)
- Scoping: Tenant-level (shared across users in tenant)
Episodic Memory (Interaction History)
EpisodicMemoryCreate- Log an interaction or eventEpisodicMemoryResponse- Episodic memory entry with timestamp- Use cases: Conversation history, user interactions, audit logs
- Features: Temporal recall, role-based filtering (user/assistant/system/tool)
- Scoping: Tenant + User + Agent (user-specific conversation history)
Procedural Memory (Skills & Procedures)
ProceduralMemoryResponse- Skill or procedure with trigger conditions- Use cases: Dynamic prompts, few-shot examples, user-specific agent customization
- Features: Context-aware retrieval, trigger-based activation, personalization
- Scoping: Tenant + User + Agent (enables per-user agent customization)
Working Memory (Plan State)
WorkingMemorySet- Store plan-scoped stateWorkingMemoryResponse- Working memory entry- Use cases: Multi-agent collaboration, plan execution state, shared variables
- Features: Plan-scoped isolation, key-value storage
- Scoping: Tenant + Plan (shared state within plan execution)
Memory Service Examples
Semantic Memory (Knowledge Storage)
from soorma_common.models import SemanticMemoryCreate
# Store knowledge
memory = SemanticMemoryCreate(
agent_id="researcher",
content="FastAPI is a modern web framework for Python",
metadata={"category": "web-dev", "language": "python"}
)
Episodic Memory (Interaction History)
from soorma_common.models import EpisodicMemoryCreate
# Log user interaction
memory = EpisodicMemoryCreate(
agent_id="chatbot",
role="user", # user, assistant, system, tool
content="How do I deploy to production?",
metadata={"session_id": "session-123", "timestamp": "2025-12-23T10:00:00Z"}
)
Working Memory (Plan State)
from soorma_common.models import WorkingMemorySet
# Store plan execution state
state = WorkingMemorySet(
value={
"plan_id": "research-plan-1",
"current_phase": "data_collection",
"completed_tasks": ["search", "filter"],
"pending_tasks": ["analyze", "report"],
"research_summary": "Found 50 relevant papers..."
}
)
Development
# Install in editable mode
pip install -e .
# Run tests
pytest
# Build package
python -m build
Version History
See CHANGELOG.md for version history and release notes.
Release files for soorma-common 0.9.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| soorma_common-0.9.1.tar.gz | 17.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| soorma_common-0.9.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.7 kB
Release files / soorma_common-0.9.1.tar.gz
| Download URL | soorma_common-0.9.1.tar.gz |
|---|---|
| Size | 17.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
805cb59bb67453a6b3bfa998b6d74bd4b85ff9305a11f2fc674d8a561edbdcbd
|
|
BLAKE2b-256 checksum How to use checksums |
5d186e572a6864ec5978b92dd30455279d9880a4ca905714666be18d82842bdd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / soorma_common-0.9.1-py3-none-any.whl
| Download URL | soorma_common-0.9.1-py3-none-any.whl |
|---|---|
| Size | 20.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ebf50ea54d7a27ae37916b3435ee8d12b83d07b7bb7c723cdaa358cfe738f583
|
|
BLAKE2b-256 checksum How to use checksums |
065d88943dcd4999811feab5e17d206b7ccf52793204a4c801708c453eccf88a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|