AgentFiles

class AgentFiles[소스]

기반 클래스: ABC

Persistent files owned by the authenticated agent.

메소드

delete(key, *, expected_revision)

Delete a file from the current view, retaining its history.

get(key)

Return the current file content and metadata.

list(*[, prefix, start_after, limit])

List live file metadata in lexicographic key order.

put(key, data, *[, expected_revision])

Create or update a file, preserving its previous revisions.

abstract delete(key: str, *, expected_revision: int) → None[소스]

Delete a file from the current view, retaining its history.

매개변수:
  • key (str) – File key within the agent’s scope.

  • expected_revision (int) – Must match the current live revision; missing or deleted files also cause a revision conflict.

abstract get(key: str) → File | None[소스]

Return the current file content and metadata.

매개변수:

key (str) – File key within the agent’s scope.

반환:

Content and metadata, or None if absent or deleted.

반환 형식:

File | None

abstract list(*, prefix: str = '', start_after: str = '', limit: int | None = None) → tuple[list[FileMetadata], str][소스]

List live file metadata in lexicographic key order.

매개변수:
  • prefix (str (default: "")) – Include only keys starting with this prefix.

  • start_after (str (default: "")) – Exclusive key cursor; empty starts from the beginning.

  • limit (int | None (default: None)) – Maximum number of entries. None returns all matches; zero returns an empty page.

반환:

Metadata and the next cursor, which is empty when no more remain.

반환 형식:

tuple[list[FileMetadata], str]

abstract put(key: str, data: bytes, *, expected_revision: int | None = None) → int[소스]

Create or update a file, preserving its previous revisions.

매개변수:
  • key (str) – Non-empty, non-whitespace file key, preserved unchanged.

  • data (bytes) – File content to store.

  • expected_revision (int | None (default: None)) – None means create-only and fails if a live file exists. Otherwise, the current live revision must match for the update to succeed.

반환:

The new revision ID.

반환 형식:

int