Skip to main content

Project

Object-centric interface for Splunk AO projects. This class provides an intuitive way to work with Splunk AO projects, encapsulating project management operations and providing seamless integration with log stream management. Examples

Create a new project locally, then persist

project = Project(name=“My AI Project”).create()

Get an existing project

project = Project.get(name=“My AI Project”)

List all projects

projects = Project.list()

Create a log stream for the project

agent_stream = project.create_agent_stream(name=“Production Logs”)

List log streams for the project

log_streams = project.list_agent_streams()

Access related resources via properties

for stream in project.agent_streams: print(stream.name) for experiment in project.experiments: print(experiment.name) for dataset in project.datasets: print(dataset.name) for prompt in project.prompts: print(prompt.name)

Or use the explicit list methods

datasets = project.list_datasets() prompts = project.list_prompts()

Manage collaborators

for collab in project.collaborators: print(f”{collab.email}: {collab.role}“)

Add a collaborator

project.add_collaborator(user_id=“user-123”, role=CollaboratorRole.EDITOR)

Update a collaborator’s role

project.update_collaborator(user_id=“user-123”, role=CollaboratorRole.VIEWER)

Remove a collaborator

project.remove_collaborator(user_id=“user-123”)

Delete a project (WARNING: cannot be undone!)

old_project = Project.get(name=“Old Project”) old_project.delete()

add_collaborator

Add a collaborator to this project. Shares the project with a user, granting them access with the specified role. Arguments
  • user_id: The ID of the user to add as a collaborator.
  • role: The role to assign. One of CollaboratorRole.OWNER, EDITOR, VIEWER, or ANNOTATOR. Defaults to VIEWER.

agent_streams

Property to access agent streams for this project. This is a read-only property that returns the current list of agent streams. To create new agent streams, use :meth:create_agent_stream. Examples project = Project.get(name=“My AI Project”) for stream in project.agent_streams: print(stream.name)

collaborators

Property to access collaborators for this project. Returns users who have access to this project. Each Collaborator object has update() and remove() methods for modifying access. You can also use add_collaborator() on the project to add new collaborators. .. note
Examples project = Project.get(name=“My AI Project”) for collab in project.collaborators: print(f”{collab.email}: {collab.role}“)

Filter by role

editors = [c for c in project.collaborators if c.role == CollaboratorRole.EDITOR]

Update or remove directly on the collaborator object

collab.update(role=CollaboratorRole.EDITOR) collab.remove()

create

Persist this project to the API. Examples project = Project(name=“My AI Project”).create() assert project.is_synced()

create_agent_stream

Create a new agent stream for this project. Arguments
  • name (str): The name of the agent stream to create.

datasets

Property to access datasets used in this project. This is a read-only property that returns the datasets associated with this project. Examples project = Project.get(name=“My AI Project”) for dataset in project.datasets: print(dataset.name)

delete

Delete this project. This is a destructive operation that permanently removes the project and all associated data (experiments, log streams, datasets, traces, etc.) from the API. WARNING: This operation cannot be undone! After successful deletion, the object state is set to DELETED. The local object still exists in memory but no longer represents a remote resource. Examples

Delete a project

project = Project.get(name=“Old Project”) project.delete() assert project.is_deleted()

After deletion, the project no longer exists remotely

The local object is marked as DELETED

print(project.sync_state) # SyncState.DELETED

experiments

Property to access experiments for this project. This is a read-only property that returns the current list of experiments. Examples project = Project.get(name=“My AI Project”) for exp in project.experiments: print(exp.name)

get

Get an existing project by ID or name. Arguments
  • id (Optional[str]): The project ID.
  • name (Optional[str]): The project name.

list

List all available projects. Examples projects = Project.list() for project in projects:

Process each project

pass

list_agent_streams

List agent streams for this project. Returns a single page of results. Use starting_token (from next_starting_token on a prior response) to fetch subsequent pages. Arguments
  • limit (Union[Unset, int]): Maximum number of agent streams per page. Defaults to 100.
  • starting_token (Union[Unset, int]): Pagination token. Defaults to 0 (first page).

list_collaborators

List all collaborators for this project. Returns a list of Collaborator objects representing users who have access to this project, along with their roles and permissions. Examples project = Project.get(name=“My AI Project”) collaborators = project.list_collaborators() for collab in collaborators: print(f”{collab.email}: {collab.role}“)

list_datasets

List all datasets used in this project. Examples project = Project.get(name=“My AI Project”) datasets = project.list_datasets() for dataset in datasets:

Process each dataset

pass

list_experiments

List all experiments for this project. Examples project = Project.get(name=“My AI Project”) experiments = project.list_experiments() for exp in experiments:

Process each experiment

pass

list_prompts

List all prompts used in this project. Examples project = Project.get(name=“My AI Project”) prompts = project.list_prompts() for prompt in prompts:

Process each prompt

pass

prompts

Property to access prompts used in this project. This is a read-only property that returns the prompts associated with this project. Examples project = Project.get(name=“My AI Project”) for prompt in project.prompts: print(prompt.name)

refresh

Refresh this project’s state from the API. Updates all attributes with the latest values from the remote API and sets the state to SYNCED. Examples project.refresh() assert project.is_synced()

remove_collaborator

Remove a collaborator from this project. Revokes a user’s access to this project. The user will no longer be able to view or interact with the project. Arguments
  • user_id: The ID of the user to remove.

save

Save changes to this project. Persists any local changes to the remote API. If the project is LOCAL_ONLY, delegates to create(). If SYNCED, returns immediately as a no-op. Raises ValueError for DELETED or FAILED_SYNC states. .. note
Examples

Create a new project

project = Project(name=“My Project”) project.save()

Update an existing project’s name via dirty-tracking

project = Project.get(name=“My Project”) project.name = “Renamed Project” # automatically marks DIRTY project.save()

update_collaborator

Update a collaborator’s role on this project. Changes the role of an existing collaborator. The user must already have access to the project. Arguments
  • user_id: The ID of the user whose role to update.
  • role: The new role to assign. One of CollaboratorRole.OWNER, EDITOR, VIEWER, or ANNOTATOR.