### Run Simple Example Script Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/sample_apps/is_agent_app/README.md Navigate to the application directory and run the simple example script to start the IS agent. ```bash cd examples/sample_apps/is_agent_app python simple_example.py ``` -------------------------------- ### Install agentUniverse and Visualization Packages Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/Get_Start/2.Run_Your_First_Tutorial_Example.md Install the core agentUniverse framework package along with the necessary visualization interface packages. This is a prerequisite for running the tutorial example. ```shell # framework package pip install agentUniverse # Visualization Interface Package pip install magent-ui ruamel.yaml ``` -------------------------------- ### Start vLLM Server with Docker Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/sample_standard_app/intelligence/agentic/llm/buildin/vllm/README.md Deploy vLLM using Docker for easier management and isolation. Ensure Docker is installed and GPU access is configured. ```bash docker run --gpus all \ -v ~/.cache/huggingface:/root/.cache/huggingface \ -p 8000:8000 \ --ipc=host \ vllm/vllm-openai:latest \ --model meta-llama/Llama-3.1-8B-Instruct ``` -------------------------------- ### Start Basic vLLM Server Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/sample_standard_app/intelligence/agentic/llm/buildin/vllm/README.md Start a basic vLLM server with a single model. This is suitable for development and testing. ```bash python -m vllm.entrypoints.openai.api_server \ --model meta-llama/Llama-3.1-8B-Instruct \ --port 8000 ``` -------------------------------- ### Configuration File Example Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/Get_Start/6.aU_Old_and_New_Project_Migration_Guide.md Example of a configuration file (config.toml) showing the CORE_PACKAGE setting, which needs to be updated for package scanning in the new project structure. ```toml CORE_PACKAGE = "intelligence" ``` -------------------------------- ### Install vLLM Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/sample_standard_app/intelligence/agentic/llm/buildin/vllm/README.md Install the vLLM library using pip. This is a prerequisite for running vLLM servers. ```bash pip install vllm ``` -------------------------------- ### Install agentUniverse Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/sample_apps/simple_qa_agent_app/README.md Install the agentUniverse framework using pip or from source. This is a prerequisite for running the application. ```bash pip install agentUniverse ``` ```bash git clone https://github.com/agentuniverse-ai/agentUniverse.git cd agentUniverse pip install -e . ``` -------------------------------- ### Start MCP Server with MCPServerManager Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/How-to/Use and Publish MCP Server/How_to_Publish_MCP_Servers.md Use the `MCPServerManager` to start the MCP server, which automatically publishes tools and toolkits marked for MCP publishing. The `AgentUniverse().start(core_mode=True)` must be called before starting the server. ```python from agentuniverse.agent_serve.web.mcp.mcp_server_manager import MCPServerManager from agentuniverse.base.agentuniverse import AgentUniverse class ServerApplication: """ Server application. """ @classmethod def start(cls): AgentUniverse().start(core_mode=True) MCPServerManager().start_server() if __name__ == "__main__": ServerApplication.start() ``` -------------------------------- ### Start Milvus Docker Container Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Tech_Capabilities/Storage/Milvus.md Use these shell commands to download the Milvus installation script and start a standalone Docker container. This provides database services on port 19530. ```shell curl -sfL https://raw.githubusercontent.com/milvus-io/milvus/master/scripts/standalone_embed.sh bash standalone_embed.sh start ``` -------------------------------- ### Agent Configuration Example Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Tutorials/Agent/Agent_Create_And_Use.md This is an example of an agent configuration file. It shows standard configuration items and highlights the use of variables within prompts for dynamic settings. ```yaml # - 'knowledge_a' metadata: type: 'AGENT' module: 'sample_standard_app.intelligence.agentic.agent.agent_instance.demo_agent' class: 'DemoAgent' ``` -------------------------------- ### Start Simple Q&A Agent Web Server Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/sample_apps/simple_qa_agent_app/README.md Launch the web server for the Simple Q&A Agent. This method is recommended for interacting with the agent. ```bash cd examples/sample_apps/simple_qa_agent_app python bootstrap/intelligence/server_application.py ``` -------------------------------- ### Install FAISS CPU or GPU Version Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Tech_Capabilities/Storage/FAISS.md Install the FAISS library. Use `faiss-cpu` for CPU-only or `faiss-gpu` for GPU-accelerated versions. ```bash # For CPU-only version pip install faiss-cpu # For GPU-accelerated version (requires CUDA) pip install faiss-gpu ``` -------------------------------- ### Start AgentUniverse Web Server Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/Get_Start/1.Application_Project_Structure_and_Explanation.md Use this statement to start the application service. Ensure the config file path is correct if it has been changed. ```python from agentuniverse.agent_serve.web.web_booster import start_web_server from agentuniverse.base.agentuniverse import AgentUniverse class ServerApplication: """ Server application. """ @classmethod def start(cls): AgentUniverse().start() start_web_server() ServerApplication.start() ``` -------------------------------- ### Start Product Service Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/How-to/Guide to Visual Agentic Workflow Platform/Product_Platform_Quick_Start.md Run the product_application.py script to initiate the agentUniverse product service. This script is located in the sample_standard_app bootstrap directory. ```python from core.utils.common import load_yaml from core.app.app import App if __name__ == '__main__': App(load_yaml('config.yaml')).run() ``` -------------------------------- ### Python Usage Example for GRR Agent Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/sample_apps/grr_agent_app/README.md This Python code demonstrates how to initialize AgentUniverse, get an instance of the GRR agent, run it with an input prompt, and retrieve the generated output. ```python from agentuniverse.agent.agent import Agent from agentuniverse.agent.agent_manager import AgentManager from agentuniverse.base.agentuniverse import AgentUniverse # 启动 AgentUniverse AgentUniverse().start(config_path='config/config.toml') # 获取 GRR agent 实例 grr_agent: Agent = AgentManager().get_instance_obj('demo_grr_agent') # 运行 agent result = grr_agent.run(input='写一篇关于人工智能的短文') # 获取结果 output = result.get('output') print(output) ``` -------------------------------- ### Configuring Kimi LLM via TOML File Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Components/LLMs/Kimi_LLM_Use.md Example of setting Kimi LLM configuration parameters, including API key and proxy, within a TOML file. This method is an alternative to Python environment variable setup. ```toml KIMI_API_KEY="sk-******" KIMI_PROXY="https://xxxxxx" KIMI_API_BASE='https://api.moonshot.cn/v1' KIMI_ORGANIZATION = '' ``` -------------------------------- ### Start MCP Server Programmatically Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Tech_Capabilities/Service/MCP_Server.md This Python code demonstrates how to start the MCP server using `MCPServerManager`. Ensure `AgentUniverse` is started first. The server can be configured with host, port, and transport type (sse or streamable_http). ```python from agentuniverse.agent_serve.web.mcp.mcp_server_manager import MCPServerManager from agentuniverse.base.agentuniverse import AgentUniverse class ServerApplication: """ Server application. """ @classmethod def start(cls): AgentUniverse().start(core_mode=True) MCPServerManager().start_server() if __name__ == "__main__": ServerApplication.start() ``` -------------------------------- ### Install agentUniverse from Source Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/sample_apps/simple_qa_agent_app/README.md Clone the agentUniverse repository and install it locally. This is useful for development or when using the latest unreleased features. ```bash git clone https://github.com/agentuniverse-ai/agentUniverse.git cd agentUniverse pip install -e . ``` -------------------------------- ### gRPC Call Example Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Tech_Capabilities/Service/gRPC.md A Python example demonstrating how to connect to the gRPC server and invoke the `service_run` and `service_run_result` methods. ```APIDOC ## gRPC Call Example This example demonstrates how to use the gRPC client to interact with the Agent service: ```python import grpc from agentuniverse.agent_serve.web.rpc.grpc import agentuniverse_service_pb2, \ agentuniverse_service_pb2_grpc # Ensure your server_application is started first. def test_run(): with grpc.insecure_channel('localhost:50051') as channel: stub = agentuniverse_service_pb2_grpc.AgentUniverseServiceStub(channel) # Example of calling service_run response = stub.service_run(agentuniverse_service_pb2.AgentServiceRequest( service_id='demo_service', params='{"input":"(18+3-5)/2*4=?"}', saved=True )) print("client received: " + response.request_id) # Example of calling service_run_result response = stub.service_run_result(agentuniverse_service_pb2.AgentResultRequest( request_id=response.request_id )) print("client received: " + response.result) ``` ``` -------------------------------- ### Implementation Agent Configuration Example Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/sample_apps/is_agent_app/README.md YAML configuration for the implementation agent, specifying its prompt version and LLM model settings. ```yaml info: name: 'demo_implementation_agent' description: 'Demo implementation agent' profile: prompt_version: 'demo_implementation_agent.cn' llm_model: name: 'qwen_llm' temperature: 0.7 # Higher creativity ``` -------------------------------- ### Task Decomposition Example (Not Recommended) Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/sample_apps/is_agent_app/README.md Illustrates an example of task decomposition with an insufficient number of checkpoints, highlighting a suboptimal approach for complex tasks. ```python # Not recommended: too few checkpoints result = agent.run( input='开发完整的Web应用', checkpoint_count=2 # Too few ) ``` -------------------------------- ### Gunicorn Configuration File Example Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Tech_Capabilities/Service/Web_Server.md An example TOML file for configuring Gunicorn server settings. This file allows detailed customization of worker processes, threads, timeouts, and more. ```toml [GUNICORN_CONFIG] bind = '127.0.0.1:8888' backlog = 2048 worker_class = 'gthread' threads = 4 workers = 5 timeout = 60 keepalive = 10 ``` -------------------------------- ### SQLDBWrapper Configuration File Example Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Tech_Capabilities/Storage/SQLDB_WRAPPER.md An example of a YAML configuration file for registering an SQLDBWrapper instance. This includes details like name, database URI, and optional arguments for SQLDatabase and SQLAlchemy engine. ```APIDOC ## SQLDBWrapper Configuration File ```yaml name: 'demo_sql' description: 'demo_sql' db_uri: "sqlite:///./demo.db" sql_database_args: include_tables: ["users"] engine_args: pool_size: 10 metadata: type: 'SQLDB_WRAPPER' ``` - **`name`**: The name of the SQLDBWrapper, used to uniquely identify an instance. - **`description`**: A brief description of the functionality of the SQLDBWrapper's. - **`db_uri`**: A SQLAlchemy-style database URI, which is used to create a SQLAlchemy engine. - **`sql_database_args`**: Optional parameters for the SQLDatabase class in `LangChain`. For specific details, refer to [LangChain's official website](https://python.langchain.com/v0.1/docs/integrations/toolkits/sql_database/). - **`engine_args`**: Optional parameters used to configure SQLAlchemy engine settings. For specific configurable options, please refer to [SQLAlchemy's webpage](https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.create_engine). - **`metadata`**: Indicates that this configuration is specific to the `SQLDB_WRAPPER`and should not be changed. ``` -------------------------------- ### Documentation Writing Task Example Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/sample_apps/is_agent_app/README.md Example of using the IS agent for writing technical documentation, with specified checkpoints and corrections to ensure completeness and accuracy. ```python result = agent.run( input='编写产品使用手册,包括安装、配置和常见问题', checkpoint_count=3, max_corrections=2 ) ``` -------------------------------- ### Configure and Start gRPC Server Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Tech_Capabilities/Service/gRPC.md Enable the gRPC server by setting 'activate' to 'true' in the config.toml file. Then, start the server using the provided Python script. The 'max_workers' and 'server_port' parameters can also be configured. ```toml [GRPC] activate = 'true' max_workers = 10 server_port = 50051 ``` -------------------------------- ### Verify agentUniverse Installation Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/sample_apps/simple_qa_agent_app/README.md Run the provided test script to confirm that the agentUniverse installation and the simple Q&A agent are set up correctly. ```bash cd examples/sample_apps/simple_qa_agent_app python intelligence/test/simple_qa_agent_test.py ``` -------------------------------- ### Get and Run a Tool Instance Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Tutorials/Tool/Tool_Create_And_Use.md Obtain a tool instance by its name from the ToolManager and execute it with provided inputs. ```python from agentuniverse.agent.action.tool.tool_manager import ToolManager tool = ToolManager().get_instance_obj('your_tool_name') tool_input = {'your_input_key': 'input_values'} tool.run(**tool_input) ``` -------------------------------- ### IS Agent Configuration Example Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/sample_apps/is_agent_app/README.md YAML configuration for the main IS agent, defining its sub-agents, default checkpoint count, and maximum corrections. ```yaml info: name: 'demo_is_agent' description: 'Demo IS agent for supervised task execution' profile: # Sub-agent configuration implementation: 'demo_implementation_agent' supervision: 'demo_supervision_agent' # Checkpoint configuration checkpoint_count: 3 # Default checkpoint count max_corrections: 2 # Maximum correction times # Expert framework (optional) expert_framework_enabled: false ``` -------------------------------- ### Direct API Key Configuration Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Components/LLMs/BaiChuan_LLM_Use.md Example of setting the API key directly as a string within the configuration file. ```yaml api_key: 'sk-xxx' ``` -------------------------------- ### Configure WenXin API Keys via TOML Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Components/LLMs/WenXin_LLM_Use.md Add QIANFAN_AK and QIANFAN_SK configurations to a custom_key.toml file for environment variable setup. ```toml QIANFAN_AK="sk-******" QIANFAN_SK="https://xxxxxx" ``` -------------------------------- ### Build Project Image Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Deployment/Project_Image_Packaging.md Navigate to the image build directory and execute the build script. Replace 'sample_standard_app' with your project's name. ```shell cd xxx/xxx/sample_standard_app/image_build chmod +x start_build.sh ./start_build.sh ``` -------------------------------- ### Start agentUniverse Framework Source: https://context7.com/agentuniverse-ai/agentuniverse/llms.txt Initializes the framework by loading configurations, registering components, and setting up logging and tracing. Use `start_web_server()` to launch the API server after initialization. ```python from agentuniverse.base.agentuniverse import AgentUniverse from agentuniverse.agent_serve.web.web_booster import start_web_server # Minimal startup — reads config from /config/config.toml by default AgentUniverse().start() # With explicit config path AgentUniverse().start(config_path="/app/config/config.toml") # config/config.toml structure # [BASE_INFO] # appname = 'my_agent_app' # [CORE_PACKAGE] # default = ['my_app.intelligence.agentic'] # [SUB_CONFIG_PATH] # custom_key_path = './custom_key.toml' # log_config_path = './logging.toml' # After start(), launch the web server start_web_server() ``` -------------------------------- ### Get Work Pattern Instance Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Tutorials/WorkPattern/WorkPattern.md Use the `get_instance_obj` method from `WorkPatternManager` to retrieve a work pattern instance by its name. Ensure the `agentuniverse` library is installed and the work pattern is configured. ```python from agentuniverse.agent.work_pattern.work_pattern_manager import WorkPatternManager work_pattern_name = 'xxx_work_pattern' work_pattern = WorkPatternManager().get_instance_obj(component_instance_name=work_pattern_name) ``` -------------------------------- ### AgentUniverse.start() Source: https://context7.com/agentuniverse-ai/agentuniverse/llms.txt Initializes the agentUniverse framework by loading configurations, setting up logging and tracing, and registering all defined components. It can be called with a default or explicit configuration path. ```APIDOC ## AgentUniverse.start() ### Description Initializes the entire agentUniverse framework. This includes loading configuration files, setting up logging and tracing, scanning for component definitions (agents, LLMs, tools, etc.), and registering them. It serves as the bootstrap function for the framework. ### Method ```python AgentUniverse().start(config_path: str = None) ``` ### Parameters * **config_path** (str, Optional) - The explicit path to the configuration file. If not provided, it defaults to `/config/config.toml`. ### Request Example ```python from agentuniverse.base.agentuniverse import AgentUniverse # Minimal startup AgentUniverse().start() # With explicit config path AgentUniverse().start(config_path="/app/config/config.toml") ``` ### Notes After calling `start()`, you typically proceed to launch other services, such as the web server using `start_web_server()`. ``` -------------------------------- ### Verify agentUniverse installation Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/Get_Start/0.Installation_and_Initialization.md Check if agentUniverse is installed by listing installed packages and filtering for 'agentUniverse'. A successful installation will display the package name and its version. ```shell pip list | grep agentUniverse ``` -------------------------------- ### HTTP GET Tool Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Components/Tools/Integrated_Tools.md The HTTP GET tool sends a GET request to a specified URL. The input should be a URL, and the output will be the text response of the GET request. ```APIDOC ## HTTP GET Tool ### Description This tool can send a GET request. Input should be a URL (e.g., https://www.google.com). The output will be the text response of the GET request. ### Tool Configuration ```yaml name: 'requests_get' description: 'A portal to the internet. Use this when you need to get specific content from a website. Input should be a url (i.e. https://www.google.com). The output will be the text response of the GET request. ```' headers: content-type: 'application/json' method: 'GET' json_parser: false response_content_type: json tool_type: 'api' input_keys: ['input'] metadata: type: 'TOOL' module: 'sample_standard_app.intelligence.agentic.tool.request_tool' class: 'RequestTool' ``` ### Usage This tool can be used directly without requiring any keys. ``` -------------------------------- ### Start vLLM Server with Quantization Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/sample_standard_app/intelligence/agentic/llm/buildin/vllm/README.md Launch a vLLM server with quantization enabled (e.g., AWQ) to reduce memory footprint and potentially improve inference speed. ```bash python -m vllm.entrypoints.openai.api_server \ --model TheBloke/Llama-2-70B-Chat-AWQ \ --quantization awq \ --port 8000 ``` -------------------------------- ### Agent Target Examples Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Tutorials/Agent/Agent.md Provides examples of good and bad agent target descriptions. Good examples are concise, impactful, and specify a domain scope. ```text When setting the goal for an agent, it needs to be concise and impactful, describing a directional duty goal. Providing a specific and specialized domain scope is optimal. ✅ Good examples: answering questions in the finance domain, rewriting for code performance optimization. ❌ Bad examples: aimless descriptions such as "just chatting." ``` -------------------------------- ### Install AgentUniverse with SLS Support Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Tech_Capabilities/Log_And_Monitor/Alibaba_Cloud_SLS.md Install the AgentUniverse package with the log extension to enable SLS integration. This command installs the necessary dependencies for log management capabilities. ```shell pip install agentuniverse[log_ext] ``` -------------------------------- ### Startup Configuration with Threads Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Tech_Capabilities/Service/Web_Server.md Configures the web server at startup, allowing specific parameters like bind address and number of threads to be set directly. This overrides settings from configuration files. ```python from agentuniverse.agent_serve.web.web_booster import start_web_server from agentuniverse.base.agentuniverse import AgentUniverse AgentUniverse().start() start_web_server(bind="127.0.0.1:8002", threads=4) ``` -------------------------------- ### LLM Configuration Example (Qwen) Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/sample_apps/grr_agent_app/README.md Configuration for the Qwen LLM, specifying model name, maximum tokens, and temperature. It also includes metadata for the DefaultOpenAILLM class. ```yaml name: 'qwen_llm' description: 'Qwen LLM configuration' model_name: 'qwen-max' max_tokens: 4096 temperature: 0.7 metadata: type: 'LLM' module: 'agentuniverse.llm.default.default_openai_llm' class: 'DefaultOpenAILLM' ``` -------------------------------- ### Direct and Async Tool Usage Source: https://context7.com/agentuniverse-ai/agentuniverse/llms.txt Demonstrates how to instantiate and run a tool directly or asynchronously using the ToolManager. Requires the tool to be registered. ```python # Direct usage from agentuniverse.agent.action.tool.tool_manager import ToolManager tool = ToolManager().get_instance_obj('stock_price_tool') result = tool.run(ticker='AAPL') print(result) # AAPL current price: $213.49 # Async usage import asyncio result = asyncio.run(tool.async_run(ticker='GOOG')) print(result) # GOOG current price: $175.12 ``` -------------------------------- ### Install AgentUniverse Dependency Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/sample_apps/is_agent_app/README.md Install the agentuniverse library using pip. This is a prerequisite for running the application. ```bash pip install agentuniverse ``` -------------------------------- ### Install Milvus Python SDK Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Tech_Capabilities/Storage/Milvus.md Install the necessary Python SDK to interact with Milvus from your agentUniverse project. ```python pip install pymilvus ``` -------------------------------- ### Chroma Store Configuration Example Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/How-to/Build and Use a Knowledge Base/How_to_Build_Knowledge_Base.md Configuration for a ChromaDB store, including its name, description, persistence path, embedding model, and similarity search parameters. ```yaml name: 'civil_law_chroma_store' description: '保存了中国民法典的所有内容,以文本向量形式存储' persist_path: '../../db/civil_law.db' embedding_model: 'dashscope_embedding' similarity_top_k: 100 metadata: type: 'STORE' module: 'agentuniverse.agent.action.knowledge.store.chroma_store' class: 'ChromaStore' ``` -------------------------------- ### Starting the gRPC Server Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Tech_Capabilities/Service/gRPC.md Python code to start the AgentUniverse application and the web server, which includes the gRPC service if activated. ```APIDOC ## Starting the gRPC Server After configuring `config.toml`, start the gRPC server using the following Python code: ```python from agentuniverse.agent_serve.web.web_booster import start_web_server from agentuniverse.base.agentuniverse import AgentUniverse AgentUniverse().start() start_web_server() ``` ``` -------------------------------- ### Install agentUniverse via pip Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/Get_Start/0.Installation_and_Initialization.md Use this command to install the agentUniverse package using pip. Ensure you have Python 3.10 or later. ```shell pip install agentUniverse ``` -------------------------------- ### HTTP GET Tool Configuration Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Components/Tools/Integrated_Tools.md Configures a tool for sending HTTP GET requests. Input should be a URL, and the output is the text response. ```yaml name: 'requests_get' description: 'A portal to the internet. Use this when you need to get specific content from a website. Input should be a url (i.e. https://www.google.com). The output will be the text response of the GET request. ```' headers: content-type: 'application/json' method: 'GET' json_parser: false response_content_type: json tool_type: 'api' input_keys: ['input'] metadata: type: 'TOOL' module: 'sample_standard_app.intelligence.agentic.tool.request_tool' class: 'RequestTool' ``` -------------------------------- ### Basic FAISS Store Initialization and Usage Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Tech_Capabilities/Storage/FAISS.md Initialize a FAISS store with IndexFlatL2, add documents, and perform a similarity search query. Ensure the client is initialized using `_new_client()` before operations. ```python from agentuniverse.agent.action.knowledge.store.faiss_store import FAISSStore from agentuniverse.agent.action.knowledge.store.document import Document from agentuniverse.agent.action.knowledge.store.query import Query # Initialize store store = FAISSStore( index_path="./data/my_faiss.index", metadata_path="./data/my_faiss_metadata.pkl", embedding_model="your_embedding_model", index_config={ "index_type": "IndexFlatL2", "dimension": 768 } ) # Initialize the client store._new_client() # Insert documents documents = [ Document(text="Python is a programming language", metadata={"topic": "programming"}), Document(text="Machine learning uses algorithms", metadata={"topic": "AI"}), ] store.insert_document(documents) # Query documents query = Query(query_str="programming languages") results = store.query(query) for doc in results: print(f"Text: {doc.text}") print(f"Score: {doc.metadata.get('score')}") ``` -------------------------------- ### Data Processing Task Example Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/sample_apps/is_agent_app/README.md Example of using the IS agent for a data processing task, such as designing and implementing a data cleaning pipeline. ```python result = agent.run( input='设计并实现一个数据清洗流程,处理CSV文件中的缺失值和异常值', checkpoint_count=4, max_corrections=2 ) ``` -------------------------------- ### Initialize HumanInputRun Tool with Configuration Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Components/Tools/Integrated_LangChain_Tools.md Use this configuration to initialize the HumanInputRun tool from LangChain. Set description to empty if you want to use the description directly from LangChain. ```yaml name: 'human_input_run' description: '' tool_type: 'api' input_keys: ['input'] langchain: module: langchain_community.tools class_name: HumanInputRun metadata: type: 'TOOL' module: 'sample_standard_app.intelligence.agentic.tool.samples.langchain_tool' class: 'LangChainTool' ``` -------------------------------- ### Code Development Task Example Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/sample_apps/is_agent_app/README.md Example of using the IS agent for a code development task, specifying checkpoints and corrections for quality assurance. ```python result = agent.run( input='实现一个RESTful API端点,包括参数验证、错误处理和文档', checkpoint_count=4, max_corrections=2 ) ``` -------------------------------- ### Deploy Signoz Locally Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Tech_Capabilities/Observability/Observability_with_OTEL.md Use this script to clone the Signoz repository, navigate to the deployment directory, make the install script executable, and then run it to deploy Signoz locally. ```shell git clone https://github.com/SigNoz/signoz.git cd signoz/deploy/ chmod +x install.sh ./install.sh ``` -------------------------------- ### Install agentUniverse UI dependencies Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/README.md Install the necessary packages for the visual agentic workflow platform. This includes the UI components and YAML handling. ```shell pip install magent-ui ruamel.yaml ``` -------------------------------- ### Python Usage of vLLM with AgentUniverse Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/sample_standard_app/intelligence/agentic/llm/buildin/vllm/README.md Demonstrates how to load a vLLM instance using LLMManager and perform simple and streaming calls. ```python from agentuniverse.llm.llm_manager import LLMManager # Load vLLM instance llm = LLMManager().get_instance_obj("vllm-llama-3.1-8b") # Simple call messages = [{"role": "user", "content": "Hello!"}] response = llm.call(messages) print(response.text) # Streaming call for chunk in llm.call(messages, streaming=True): print(chunk.text, end="", flush=True) ``` -------------------------------- ### Initialize and Use Basic Document Classifier Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/third_party_examples/tools/document_classifier_tool/docs/DocumentClassifier.md Demonstrates how to create a DocumentClassifier instance, set categories, add keyword rules, and classify a document. Ensure the Document class and DocumentClassifier are imported. ```python from agentuniverse.agent.action.knowledge.store.document import Document from examples.third_party_examples.tools.document_classifier_tool.document_classifier import DocumentClassifier # 创建分类器 classifier = DocumentClassifier() # 设置分类类别 classifier.set_categories(['技术文档', '学术论文', '新闻资讯', '其他']) # 添加关键词规则 classifier.add_keyword_rule('技术文档', ['代码', '编程', 'API', '函数']) # 分类文档 doc = Document(text="这是一个Python编程教程") classified_doc = classifier._classify_document(doc) ``` -------------------------------- ### Configure LLM API Key Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/sample_apps/is_agent_app/README.md Set your LLM API key as an environment variable. This example uses Tongyi Qianwen (通义千问) as an example. ```bash export DASHSCOPE_API_KEY="your_api_key_here" ``` -------------------------------- ### Configuring PromptToolkit Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/examples/third_party_examples/apps/prompt_toolkit_app/prompt/README.md Sets up configuration for PromptToolkit, including enabling auto-optimization, defining default scenario and complexity, specifying optimization strategies, and setting a confidence threshold. This allows customization of the toolkit's behavior. ```python from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_toolkit import PromptToolkitConfig from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_generator import PromptScenario, PromptComplexity from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_optimizer import OptimizationStrategy config = PromptToolkitConfig( enable_auto_optimization=True, # Enable automatic optimization default_scenario=PromptScenario.CONVERSATIONAL, # Default scenario default_complexity=PromptComplexity.MEDIUM, # Default complexity optimization_strategies=[ OptimizationStrategy.CLARITY, OptimizationStrategy.STRUCTURE ], confidence_threshold=0.6 # Confidence threshold ) ``` -------------------------------- ### Test Demo Agent using AgentManager Source: https://github.com/agentuniverse-ai/agentuniverse/blob/master/docs/guidebook/en/In-Depth_Guides/Tutorials/Agent/Agent_Create_And_Use.md Python code demonstrating how to initialize AgentUniverse, retrieve an agent instance by name from the AgentManager, and run it with input. ```python import unittest from agentuniverse.agent.agent import Agent from agentuniverse.agent.agent_manager import AgentManager from agentuniverse.agent.output_object import OutputObject from agentuniverse.base.agentuniverse import AgentUniverse class DemoAgentTest(unittest.TestCase): """ Test cases for the demo agent """ def setUp(self) -> None: AgentUniverse().start(config_path='../../config/config.toml') def test_demo_agent(self): """Test demo agent.""" instance: Agent = AgentManager().get_instance_obj('demo_agent') output_object: OutputObject = instance.run(input="What is the reason for the sharp rise in Nvidia's stock?") print(output_object.get_data('output')) if __name__ == '__main__': unittest.main() ```