Update an existing agent Args: agent_id (str): ID of the agent name (str): Name of the agent description (str): Description of the agent system (str): System configuration tool_ids (List[str]): List of tools me
(
self,
agent_id: str,
name: Optional[str] = None,
description: Optional[str] = None,
system: Optional[str] = None,
tool_ids: Optional[List[str]] = None,
metadata: Optional[Dict] = None,
llm_config: Optional[LLMConfig] = None,
embedding_config: Optional[EmbeddingConfig] = None,
message_ids: Optional[List[str]] = None,
tags: Optional[List[str]] = None,
)
| 643 | return self.get_agent(agent_state.id) |
| 644 | |
| 645 | def update_agent( |
| 646 | self, |
| 647 | agent_id: str, |
| 648 | name: Optional[str] = None, |
| 649 | description: Optional[str] = None, |
| 650 | system: Optional[str] = None, |
| 651 | tool_ids: Optional[List[str]] = None, |
| 652 | metadata: Optional[Dict] = None, |
| 653 | llm_config: Optional[LLMConfig] = None, |
| 654 | embedding_config: Optional[EmbeddingConfig] = None, |
| 655 | message_ids: Optional[List[str]] = None, |
| 656 | tags: Optional[List[str]] = None, |
| 657 | ) -> AgentState: |
| 658 | """ |
| 659 | Update an existing agent |
| 660 | |
| 661 | Args: |
| 662 | agent_id (str): ID of the agent |
| 663 | name (str): Name of the agent |
| 664 | description (str): Description of the agent |
| 665 | system (str): System configuration |
| 666 | tool_ids (List[str]): List of tools |
| 667 | metadata (Dict): Metadata |
| 668 | llm_config (LLMConfig): LLM configuration |
| 669 | embedding_config (EmbeddingConfig): Embedding configuration |
| 670 | message_ids (List[str]): List of message IDs |
| 671 | tags (List[str]): Tags for filtering agents |
| 672 | |
| 673 | Returns: |
| 674 | agent_state (AgentState): State of the updated agent |
| 675 | """ |
| 676 | request = UpdateAgent( |
| 677 | name=name, |
| 678 | system=system, |
| 679 | tool_ids=tool_ids, |
| 680 | tags=tags, |
| 681 | description=description, |
| 682 | metadata=metadata, |
| 683 | llm_config=llm_config, |
| 684 | embedding_config=embedding_config, |
| 685 | message_ids=message_ids, |
| 686 | ) |
| 687 | response = requests.patch(f"{self.base_url}/{self.api_prefix}/agents/{agent_id}", json=request.model_dump(), headers=self.headers) |
| 688 | if response.status_code != 200: |
| 689 | raise ValueError(f"Failed to update agent: {response.text}") |
| 690 | return AgentState(**response.json()) |
| 691 | |
| 692 | def get_tools_from_agent(self, agent_id: str) -> List[Tool]: |
| 693 | """ |
no test coverage detected