Eclipse
  • Get Started
    • Introduction
    • Installation
    • Quick Start
    • Tokenomics
    • Links
  • Key Components
    • Pipe
    • Agent
    • Memory
    • LLM Clients
    • Engine
    • Prompt Template
    • Handler
Powered by GitBook
On this page
  • Eclipse Agent
  • Agent Parameters
  • Example Usage
  • Agent Configuration
  1. Key Components

Agent

Eclipse Agent

In the Eclipse framework, an Agent is a system or program initialized with specific goals and roles, enabling interaction with a Large Language Model (LLM) through predefined prompt templates. Agents are designed to execute tasks by following a set of instructions and can be customized with various parameters to adapt their behavior to different workflows. Essentially, an agent acts as a flexible tool that can be fine-tuned to carry out specific functions based on user needs.

Agent Parameters

Attribute
Parameter
Description

Goal

goal

The primary objective or goal that the agent is designed to achieve.

Role

role

The role or function that the agent will assume in its operations.

LLM Client

llm

Interface for communicating with the Large Language Model (LLM).

Prompt Template

prompt_template

Defines the structure and format of prompts sent to the LLM using PromptTemplate.

Agent ID (optional)

agent_id

A unique identifier for the agent. If not provided, a new UUID will be generated by default. Useful for tracking or referencing the agent in multi-agent environments.

Name (optional)

name

An optional name for the agent, providing a more user-friendly reference for display or logging purposes.

Description (optional)

description

An optional description that provides additional context or details about the agent’s purpose and capabilities.

Engines (optional)

engines

A list of engines (or lists of engines) that the agent can utilize. This allows for flexibility in processing and task execution based on different capabilities or configurations.

Output Format (optional)

output_format

Specifies the desired format for the agent’s output, dictating how results are structured and presented.

Max Retry (optional)

max_retry

The maximum number of retry attempts for operations that may fail. Default is set to 5. This is particularly useful in scenarios where transient errors may occur, ensuring robust execution.

Example Usage

from eclipse.agent import Agent

ecom_agent = Agent(
    name='Ecom Agent',
    goal="Get me the best search results",
    role="You are the best product searcher",
    llm=llm_client,
    prompt_template=prompt_template,
    engines=[[amazon_engine, walmart_engine]],
    agent_id="ecom-id-1",
    description=(
        "E-commerce enables buying and selling products online, "
        "providing customers with the convenience of shopping anytime, anywhere. "
        "It connects buyers and sellers through digital platforms, offering "
        "secure transactions and delivery."
    ),
    output_format="Generate as JSON format",
    max_retry=5
)

Agent Configuration

Sequence Execution

In sequence execution, engines are performed one after another, with each engine waiting for the previous one to finish before starting. This approach is simple but can be slow if engines are independent.

from eclipse.agent import Agent

agent = Agent(
    ...,
    engines=[engine_1, engine_2, engine_3, ..., engine_n],
    ...
)

# Engines will execute in the following order:
# [engine_1, engine_2, engine_3, ..., engine_n]

Alternate Configuration:

from eclipse.agent import Agent

agent = Agent(
    ...,
    ...
)

await agent.add(engine_1, engine_2, execute_type='SEQUENCE')
...
await agent.add(engine_3, engine_4, execute_type='SEQUENCE')
...

# Engines will execute in the following order:
# [engine_1, engine_2, engine_3, engine_4]

Parallel Execution

In parallel execution, engines run simultaneously, speeding up the process by utilizing multiple threads or processes.

from eclipse.agent import Agent

agent = Agent(
    ...,
    engines=[[engine_1, engine_2, engine_3, ..., engine_n]],
    ...
)

# Engines will execute in the following order:
# [[engine_1, engine_2, engine_3, ..., engine_n]]

Alternate Configuration:

from eclipse.agent import Agent

agent = Agent(
    ...,
    ...
)

await agent.add(engine_1, engine_2, execute_type='PARALLEL')
...
await agent.add(engine_3, engine_4, execute_type='PARALLEL')
...

# Engines will execute in the following order:
# [[engine_1, engine_2, engine_3, engine_4]]

Mixed Execution (Sequence and Parallel)

Agents can also be configured to use a combination of sequence and parallel execution modes.

from eclipse.agent import Agent

agent = Agent(
    ...,
    engines=[engine_1, [engine_2, engine_3], engine_4, ..., engine_n],
    ...
)

# Engines will execute in the following order:
# [engine_1, [engine_2, engine_3], engine_4, ..., engine_n]

Alternate Configuration:

from eclipse.agent import Agent

agent = Agent(
    ...,
    ...
)

await agent.add(engine_1, engine_2, execute_type='SEQUENCE')
...
await agent.add(engine_3, engine_4, execute_type='PARALLEL')
...

# Engines will execute in the following order:
# [engine_1, engine_2, [engine_3, engine_4]]

By configuring agents with sequence, parallel, or mixed execution modes, you can optimize task processing to suit the specific requirements of your application.

PreviousPipeNextMemory

Last updated 4 months ago