Skip to main content

AgentNeo Python SDK

Project description

AgentNeo

To install the package

pip install agentneo -U

Authentication

Creates an authenticated session with AgentNeo

from agentneo import AgentNeo

To authenticate

agent_session = AgentNeo(
    access_key=ACCESS_KEY,
    secret_key=SECRET_KEY,
    base_url=BASE_URL
)

Project Management

Allows listing and creating projects

from agentneo import Project

# To list the available projects
Project.list_projects(session=agent_session)

# To create a new project
project = Project(session=agent_session, 
                  project_name="project_name", 
                  description="Project Description").create()

Trace Management

Enables tracing of agents, methods, and LangGraph graphs

from agentneo import Trace

# Create a tracer object
tracer = Tracer(session=agent_session)

# Decorator to trace agents & methods
@tracer.trace_node

# Decorator to trace Langgraph graphs
@tracer.trace_graph

# To add callbacks to LLMs
openai_llm = ChatOpenAI(other_parameters, 
                        ... , 
                        callbacks=[tracer.get_callback_handler()])
                        
# To upload the recorded traces
trace_id = tracer.upload_trace()

Dataset Management

Allows creation and management of datasets

from agentneo import Dataset

# To list the available Datasets
Dataset.list_datasets(session=agent_session)

# To define a new dataset
dataset = Dataset(
    session=agent_session,
    project_id=project_id, 
    dataset_name="test_dataset1", 
    description="A test dataset"
)

# Create dataset from recorded trace
dataset_traced = dataset.from_trace(trace_id=tracer.id, trace_filter=None)

# Create dataset from json dataset
dataset_json = dataset.from_json(json_filepath=filepath, 
                                 schema={"key": "value"})

Experiment Management

Allows creation, execution, and analysis of experiments

from agentneo import Experiment

# To list the available experiments
Experiment.list_experiments(session=agent_session)

# Create a new experiment 
experiment_object = Experiment(
        session=agent_session,
        experiment_name="ExperimentName",
        description="Sample Description",
        dataset_id=dataset_traced['id'],
        project_id=project_id
    )

experiment_created = experiment_object.create()

# To run a metric
exp = experiment.execute(metrics=[
    {
            "name": "goal_fulfillment_rate", 
            "config": {
                    "model": "gpt-4o-mini", 
                    "OPENAI_API_KEY": os.environ.get("OPENAI_API_KEY")
            }
    }
])

# To run multiple metrics together
exp = experiment.execute(metrics=[
    {
            "name": "summarise", 
            "config": {}
    },
    {
            "name": "tool_correctness", 
            "config": {
                    "model": "gpt-4o-mini", 
                    "OPENAI_API_KEY": os.environ.get("OPENAI_API_KEY")
            }
    },
    {
            "name": "tool_call_success_rate", 
            "config": {
                    "model": "gpt-4o-mini", 
                    "OPENAI_API_KEY": os.environ.get("OPENAI_API_KEY")
            }
    },
    {
            "name": "goal_fulfillment_rate", 
            "config": {
                    "model": "gpt-4o-mini", 
                    "OPENAI_API_KEY": os.environ.get("OPENAI_API_KEY")
            }
    }
])

# To get the results of the experiments run
experiment.get_results(exp.id)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentneo-0.1.3b2.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

agentneo-0.1.3b2-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file agentneo-0.1.3b2.tar.gz.

File metadata

  • Download URL: agentneo-0.1.3b2.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for agentneo-0.1.3b2.tar.gz
Algorithm Hash digest
SHA256 37419cf59ed0e7a238eac12cf8449f16a3b5293d5201f5e422657ff018f6af39
MD5 0df5e403c6ed75613e43ec8e9e9ec5c2
BLAKE2b-256 04529baea563f18dfcf6abc5e2f306b90524d03c91e872092fd8fe7bffca6bc2

See more details on using hashes here.

File details

Details for the file agentneo-0.1.3b2-py3-none-any.whl.

File metadata

  • Download URL: agentneo-0.1.3b2-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for agentneo-0.1.3b2-py3-none-any.whl
Algorithm Hash digest
SHA256 37f84afe90e4c69bec8941593de2cb733be64afe53722ac30d006409211b0cac
MD5 e7f4dbd803678aa14bc38d12e0dee0f3
BLAKE2b-256 360908036b26a7333643403e6ce92a55405c17ac2c4b436a119a99b86bb27b1c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page