Skip to main content

Quickstart

First install the packages:

pip install pure_agent 

setup your config.yaml

env:
  api_key: xxx
infer_params:
  model: gpt-4o-mini
  temperature: 0.8
  top_p: 0.8
  max_tokens: 512

write your first agent based on pure_agent!

from pure_agent import BaseAgent, RoleCtx, append_msg

class MyAgent(BaseAgent):
    @append_msg()
    def greeting(self, sys_name, prompt):
        with RoleCtx('system'):
            yield f"You are a helpful assistant, your name is {sys_name}."
        with RoleCtx('user'):
            yield prompt

agent = MyAgent(client_config='config.yaml')
response = agent.greeting('agent0', 'who are u?')
print(response)

use multi-thread:

from pure_agent import *

class MyAgent(BaseAgent):
    @append_msg(return_async_task=True)
    def greeting(self, sys_name, prompt):
        with RoleCtx('system'):
            yield f"You are a helpful assistant, your name is {sys_name}."
        with RoleCtx('user'):
            yield prompt

sys_names = ['pbot0', 'pbot1']
prompts = ['who are u?', 'who are u?']
with MultiThreadExecutor(10, '.cache') as pool:
    for i in range(len(sys_names)):
        agent = MyAgent(client_config='config.yaml')
        task = agent.greeting(sys_names[i], prompts[i])
        # print(pretty_print_nested(msgs))
        pool.submit(task)

Metadata

Release files for pure-agent 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pure-agent 0.1.3
File Size Uploaded Provenance Actions
pure_agent-0.1.3.tar.gz 8.4 kB Without provenance Details for pure_agent-0.1.3.tar.gz

Release files / pure_agent-0.1.3.tar.gz

Download URL pure_agent-0.1.3.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
40404e58320a35ac03f1cdcccabf5f0e46f19989f754d8652b8df683c5942707
BLAKE2b-256 checksum
How to use checksums
ff8fb23d08666e53bedcd941246e52138fbe970fa7c96dd6c8375d49757d6d33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.0

Security for pure-agent 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.3 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page