SDK Resource Management
Manage project resources and Team memory settings programmatically.
#SDK Resource Configuration
Use Agent or Swarm constructor declarations for assets needed by that scope. Use client.resources, client.skills, and client.memory to manage stored assets explicitly. These operations require an authenticated client and the server's permissions for the target scope.
#Attach a skill
Constructor skills accepts Skill objects or dictionaries matching that model. A skill needs a name, description, and one to eight steps. Each step has a positive index and a non-empty action.
from maivn import Agent, Skill, SkillStep
summarization = Skill(
name="support-summary",
description="Summarize a support case with a decision and supporting evidence.",
steps=(SkillStep(index=1, action="State the decision and cite the case facts."),),
)
agent = Agent(name="support-agent")
agent.add_skill(summarization) # Registers remotely and attaches the returned ID.add_skill registers remotely and attaches the returned skill ID. Constructor skills=[...] only normalizes and stores the declarations in this SDK; it does not register or attach them automatically. Use add_skill or attach_skill when the skill must participate in an invocation. MemorySkillConfig is a compatibility schema; it is not accepted as a constructor skill object. Use Skill for current code.
#Attach a resource
Constructor resources accepts dictionaries. Supply a non-empty text_content or a readable file, plus name and mime_type. To bind the uploaded resource to this agent, set binding_type="agent"; use "swarm" for a swarm.
from maivn import Agent
agent = Agent(
name="support-agent",
resources=[{
"file": "support-policy.md",
"name": "Support policy",
"mime_type": "text/markdown",
"binding_type": "agent",
}],
)Registration runs before the first invocation and is cached on that scope instance. Without binding_type, this constructor path uploads without creating an agent/swarm binding. path, content_base64, and a resource ID alone are not supported content inputs for this path. MemoryResourceConfig objects are not accepted as constructor resource entries.
To replace a stored resource by ID or upload bytes directly, use the resource client instead. Do not expect changing a file after the scope's first invocation to trigger another upload.
#Manage stored resources
from pathlib import Path
from maivn import Client, ResourceUploadOptions
client = Client()
resource = client.resources.upload(
Path("support-policy.md").read_bytes(),
media_type="text/markdown",
name="Support policy",
)
client.resources.bind(
resource.resource_id, binding_type="agent", target_id="support-agent",
)
# Supply an existing ID when uploading a replacement version.
replacement = client.resources.upload(
Path("support-policy.md").read_bytes(),
media_type="text/markdown",
name="Support policy",
options=ResourceUploadOptions(resource_id=resource.resource_id),
)The server compares content hashes. Reusing bytes can reuse an existing resource; replacement content can create a new version. The upload request still sends the bytes: deduplication is not a promise of zero network traffic.
client.resources also exposes list, get, patch, delete, restore, and rebind. Delete is a soft deletion; rebind returns an agent/swarm resource to Portal scope. Each method has an async counterpart prefixed with a.
#Manage skills and memory
These methods also have async counterparts. First-class skill authoring uses Skill and SkillSet. Memory CRUD uses MemorySkillCreate, MemorySkillUpdate, MemoryInsightCreate, and MemoryInsightUpdate. They are different request models; do not interchange them.
for receipt in client.memory.enrichments.list(session_id):
print(receipt)A response or extraction-start event does not prove persistence completed. Inspect the returned receipts when the application needs that outcome.
#Configure invocation memory
Use MemoryConfig to control retrieval and persistence. Some legacy fields are accepted but not forwarded; see the Session Config reference. Administrative asset operations and invocation memory policy are separate.