_agent.py

agentscope · ai, agent-orchestration, unified-agent

Agent: unified agent class

# -*- coding: utf-8 -*-
"""The unified agent class in AgentScope library."""
import asyncio
import collections
import inspect
import re
import warnings

from asyncio import Queue
from copy import deepcopy
from fnmatch import fnmatch
from datetime import datetime
from typing import (
    Any,
    AsyncGenerator,
    Sequence,
    List,
    TYPE_CHECKING,
    Type,
)

import jsonschema
from pydantic import BaseModel

from ._config import ContextConfig, ReActConfig, ModelConfig, InjectionConfig
from ..state import AgentState
from ..state._state import ReplyContext
from ._utils import _ToolCallBatch, Acting, Exit, Reasoning, _resolve_timezone
from .._logging import logger
from .._utils._common import (
    _generate_id,
    _json_loads_with_repair,
    _execute_async_or_sync_func,
)
from ..eve

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key