cognee.agents
Static class for managing agents and their connections. Each agent is backed by its own agent user with a one-time API key, and every operation is scoped to the acting user — permissions are enforced per acting user before any agent is created or any dataset is granted.Agent emails are displayed in their
{slug}@cognee.agent form. Internally each
agent user is minted with a unique {slug}+{parent_id}@cognee.agent address; the
SDK strips the +{parent_id} segment before returning the email.Methods
agents.create()
read and write access to one or
more datasets. Each requested dataset is resolved and the calling user’s
read access to it is verified before the agent user is minted, so a failed
authorization never leaves an orphaned agent user with a live API key.
Returns a dict with the agent id, display email, and the one-time API key:
agents.list()
agent_id,
agent_email, and api_key_label.
agents.get()
agent_id, agent_email, api_key_label) for a single agent.
Raises ValueError if the agent does not exist, or PermissionDeniedError if the
acting user is not authorized to view it.
agents.delete()
ValueError if the agent does not exist, or
PermissionDeniedError if the acting user is not authorized to delete it.
agents.register()
read access to every
supplied dataset (by id and by name) is validated before the connection is
created. Returns the connection as a JSON-serializable dict.
agents.unregister()
agents.list_connections()
total/has_more are adjusted accordingly.
agents.get_connection()
None if no matching
connection is found.
CLI
The same operations are available from the command line via thecognee-cli agents command.