Agent templates payloads service¶
consortium.server.services.agent_templates_payloads_service
¶
AgentTemplatesPayloadsService(agent_template_id)
¶
reserve_payload_id()
¶
See PayloadsService.reserve_resource_id.
create_payload_file(build_parameters, content, payload_data=None, payload_id=None, name=None, description='')
async
¶
Creates a file-based payload associated with the bound agent template.
Forwards to PayloadsService.create_payload_file, injecting the agent template
ID bound to this service so the caller does not need to supply it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
build_parameters
|
dict[str, Any]
|
Parameters used to build the agent generator from the bound agent template (validated against the template). |
required |
content
|
str | bytes | TextIO | BinaryIO
|
The file content to write to the repository, supplied either
as an in-memory |
required |
payload_data
|
dict[str, Any] | None
|
Arbitrary metadata attached to the payload. When |
None
|
payload_id
|
str | UUID | None
|
A previously reserved ID to assign to this payload. When
|
None
|
name
|
str | None
|
A human-readable name for the payload file. When |
None
|
description
|
str
|
An optional description for the payload. |
''
|
Returns:
| Type | Description |
|---|---|
Payload
|
The created payload. |
Raises:
| Type | Description |
|---|---|
AgentTemplateIDNotFoundError
|
If the bound agent template ID no longer exists. |
MissingRequiredAgentTemplateOptionError
|
If a required option is absent
from |
AgentTemplateOptionNotFoundError
|
If |
AgentTemplateOptionValueValidationError
|
If an option value in
|
AgentTemplateValidatingFunctionError
|
If the agent template's validating function rejects the resolved options. |
ResourceIDReservationNotFoundError
|
If |
RepositoryResourceFileSystemError
|
If the file cannot be written to disk. |
RepositoryMetadataFileSystemError
|
If the metadata file cannot be written to disk. |
create_payload_directory(build_parameters, content, payload_data=None, payload_id=None, archive_file_format='zip', name=None, description='')
async
¶
Creates a directory-based payload associated with the bound agent template.
Forwards to PayloadsService.create_payload_directory, injecting the agent
template ID bound to this service so the caller does not need to supply it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
build_parameters
|
dict[str, Any]
|
Parameters used to build the agent generator from the bound agent template (validated against the template). |
required |
content
|
bytes | BinaryIO
|
The archive content to extract into the repository directory,
supplied either as raw |
required |
payload_data
|
dict[str, Any] | None
|
Arbitrary metadata attached to the payload. When |
None
|
payload_id
|
str | UUID | None
|
A previously reserved ID to assign to this payload. When
|
None
|
archive_file_format
|
Literal['zip', 'tar', 'gztar', 'bztar', 'xztar']
|
The format of the archive to extract. Defaults to
|
'zip'
|
name
|
str | None
|
A human-readable name for the payload directory. When |
None
|
description
|
str
|
An optional description for the payload. |
''
|
Returns:
| Type | Description |
|---|---|
Payload
|
The created payload. |
Raises:
| Type | Description |
|---|---|
AgentTemplateIDNotFoundError
|
If the bound agent template ID no longer exists. |
MissingRequiredAgentTemplateOptionError
|
If a required option is absent
from |
AgentTemplateOptionNotFoundError
|
If |
AgentTemplateOptionValueValidationError
|
If an option value in
|
AgentTemplateValidatingFunctionError
|
If the agent template's validating function rejects the resolved options. |
ResourceIDReservationNotFoundError
|
If |
RepositoryResourceFileSystemError
|
If the directory cannot be created or the archive cannot be unpacked into it. |
RepositoryMetadataFileSystemError
|
If the metadata file cannot be written to disk. |
add_payload_file(build_parameters, path, payload_data=None, payload_id=None, name=None, description='', copy=False)
async
¶
Registers an existing file on disk as a payload for the bound agent template.
Forwards to PayloadsService.add_payload_file, injecting the agent template
ID bound to this service so the caller does not need to supply it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
build_parameters
|
dict[str, Any]
|
Parameters used to build the agent generator from the bound agent template (validated against the template). |
required |
path
|
Path | str
|
Path to the existing file to register. |
required |
payload_data
|
dict[str, Any] | None
|
Arbitrary metadata attached to the payload. When |
None
|
payload_id
|
str | UUID | None
|
A previously reserved ID to assign to this payload. When
|
None
|
name
|
str | None
|
A human-readable name for the payload file. When |
None
|
description
|
str
|
An optional description for the payload. |
''
|
copy
|
bool
|
When |
False
|
Returns:
| Type | Description |
|---|---|
Payload
|
The registered payload. |
Raises:
| Type | Description |
|---|---|
AgentTemplateIDNotFoundError
|
If the bound agent template ID no longer exists. |
MissingRequiredAgentTemplateOptionError
|
If a required option is absent
from |
AgentTemplateOptionNotFoundError
|
If |
AgentTemplateOptionValueValidationError
|
If an option value in
|
AgentTemplateValidatingFunctionError
|
If the agent template's validating function rejects the resolved options. |
ResourceIDReservationNotFoundError
|
If |
RepositoryResourceFileSystemError
|
If no file exists at |
RepositoryMetadataFileSystemError
|
If the metadata file cannot be written to disk afterwards. |
add_payload_directory(build_parameters, path, payload_data=None, payload_id=None, name=None, description='', copy=False)
async
¶
Registers an existing directory on disk as a payload for the bound agent template.
Forwards to PayloadsService.add_payload_directory, injecting the agent
template ID bound to this service so the caller does not need to supply it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
build_parameters
|
dict[str, Any]
|
Parameters used to build the agent generator from the bound agent template (validated against the template). |
required |
path
|
Path | str
|
Path to the existing directory to register. |
required |
payload_data
|
dict[str, Any] | None
|
Arbitrary metadata attached to the payload. When |
None
|
payload_id
|
str | UUID | None
|
A previously reserved ID to assign to this payload. When
|
None
|
name
|
str | None
|
A human-readable name for the payload directory. When |
None
|
description
|
str
|
An optional description for the payload. |
''
|
copy
|
bool
|
When |
False
|
Returns:
| Type | Description |
|---|---|
Payload
|
The registered payload. |
Raises:
| Type | Description |
|---|---|
AgentTemplateIDNotFoundError
|
If the bound agent template ID no longer exists. |
MissingRequiredAgentTemplateOptionError
|
If a required option is absent
from |
AgentTemplateOptionNotFoundError
|
If |
AgentTemplateOptionValueValidationError
|
If an option value in
|
AgentTemplateValidatingFunctionError
|
If the agent template's validating function rejects the resolved options. |
ResourceIDReservationNotFoundError
|
If |
RepositoryResourceFileSystemError
|
If no directory exists at |
RepositoryMetadataFileSystemError
|
If the metadata file cannot be written to disk afterwards. |
delete_payload_by_payload_id(payload_id)
async
¶
Deletes a payload's repository resource.
Forwards to PayloadsService.delete_payload_by_resource_id. A payload is just a
repository resource whose data field carries its metadata, so deleting the
resource removes the payload in full and a PAYLOAD_DELETED event is emitted
unconditionally on success.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload_id
|
str | UUID
|
The ID of the payload to delete. |
required |
Raises:
| Type | Description |
|---|---|
ResourceNotFoundError
|
If no payload with the given ID exists. |
RepositoryResourceFileSystemError
|
If the resource cannot be removed from disk. |
RepositoryMetadataFileSystemError
|
If the metadata file cannot be written to disk. |
get_payload_by_payload_id(payload_id)
¶
See PayloadsService.get_payload_by_resource_id.
get_all_payloads()
¶
See PayloadsService.get_all_payloads.