---
title: Agent
description: Represents a Lightning AI Agent.
canonical: 'https://lightning.ai/docs/sdk/stable/api/agent'
---
# Agent {#agent}

### `class lightning_sdk.Agent(agent_id)` {#lightning_sdk.Agent}

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object "(in Python v3.15)")

Represents a Lightning AI Agent.

Agents expose an AI assistant endpoint backed by a custom model and prompt configuration. Use [`create_agent()`](/docs/sdk/2026.11.04/api/teamspace.md#lightning_sdk.Teamspace.create_agent "lightning_sdk.Teamspace.create_agent") to create a new agent, then use this class to update or delete it.

Fetch an existing agent by its ID.

Parameters:

*   **agent\_id** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")) – The unique identifier of the agent to fetch.
    
*   **agent\_id** ([_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)"))
    

Raises:

[**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError "(in Python v3.15)") – If no agent with the given ID exists.

#### `delete()` {#lightning_sdk.Agent.delete}

Permanently delete the agent and its associated endpoint.

Return type:

[`None`](https://docs.python.org/3/builtins/constants.html#None "(in Python v3.15)")

#### `update(base_url=None, api_key=None, name=None, model=None, description=None, prompt_template=None, prompt_suggestions=None, knowledge=None, publish_status=None)` {#lightning_sdk.Agent.update}

Update the agent configuration and its backing endpoint.

All parameters are optional; only the provided values are updated.

Parameters:

*   **base\_url** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")\[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")\]) – New base URL for the model endpoint. Defaults to None.
    
*   **api\_key** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")\[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")\]) – New API key for authenticating with the endpoint. Defaults to None.
    
*   **name** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")\[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")\]) – New display name for the agent. Defaults to None.
    
*   **model** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")\[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")\]) – New model identifier to use. Defaults to None.
    
*   **description** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")\[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")\]) – New human-readable description for the agent. Defaults to None.
    
*   **prompt\_template** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")\[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")\]) – New system prompt template. Defaults to None.
    
*   **prompt\_suggestions** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")\[[`List`](https://docs.python.org/3/library/typing.html#typing.List "(in Python v3.15)")\[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")\]\]) – New list of suggested user prompts shown in the UI. Defaults to None.
    
*   **knowledge** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")\[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")\]) – New knowledge-base content or reference for the agent. Defaults to None.
    
*   **publish\_status** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")\[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")\]) – New publish status (e.g. `"published"` or `"draft"`). Defaults to None.
    
*   **base\_url** ([_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") _|_ _None_)
    
*   **api\_key** ([_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") _|_ _None_)
    
*   **name** ([_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") _|_ _None_)
    
*   **model** ([_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") _|_ _None_)
    
*   **description** ([_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") _|_ _None_)
    
*   **prompt\_template** ([_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") _|_ _None_)
    
*   **prompt\_suggestions** ([_List_](https://docs.python.org/3/library/typing.html#typing.List "(in Python v3.15)")_\[_[_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")_\]_ _|_ _None_)
    
*   **knowledge** ([_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") _|_ _None_)
    
*   **publish\_status** ([_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") _|_ _None_)
    

Return type:

[`None`](https://docs.python.org/3/builtins/constants.html#None "(in Python v3.15)")

---

**Navigation**

- Parent: [API Reference](/docs/sdk/2026.11.04/api.md)
