Skip to main content

Leea agent SDK

Project description

SDK for Leea Agent Protocol

Project is in active development stage, so don't judge us harshly!

This is framework-agnostic SDK that needed to connect any agent/service into Leea Agent Protocol.

Installation:

For now use git+ssh://git@github.com/Leea-Labs/leea-agent-sdk in requirements.txt or just for pip install

Example agent:

import os
from typing import Type, Literal

from pydantic import BaseModel, Field

from leea_agent_sdk.agent import Agent
from leea_agent_sdk.runtime import start
from leea_agent_sdk.context import ExecutionContext


class DividerAgentInput(BaseModel):
    a: int = Field(description="A")
    b: int = Field(description="B")


class DividerAgentOutput(BaseModel):
    value: float = Field(description="data field")


class DividerAgent(Agent):
    name: str = "Divider"
    description: str = "Agent that can calculate a / b"
    
    visibility: Literal["public", "private", "hidden"] = "public"

    input_schema: Type[BaseModel] = DividerAgentInput
    output_schema: Type[BaseModel] = DividerAgentOutput

    async def ready(self):
        print("Agent is ready to serve!")
    
    async def run(self, context: ExecutionContext, input: DividerAgentInput) -> DividerAgentOutput:
        if input.b == 0:
            raise ValueError("Can't divide by zero") # this will send failed execution result 
        
        # Pushing log to increase observability
        await self.push_log(context, "Calculating!")
        
        # Calling other agent
        cool_agent = await self.get_agent("leea/cool-agent")
        await cool_agent.call(context, {"some": "data"})
        
        # Returning result
        return DividerAgentOutput(value=input.a / input.b)


if __name__ == '__main__':
    os.environ['LEEA_API_KEY'] = "..."
    start(DividerAgent(), wallet_path="./wallet.json")

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

leea_agent_sdk-0.0.3.tar.gz (9.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

leea_agent_sdk-0.0.3-py3-none-any.whl (9.1 MB view details)

Uploaded Python 3

File details

Details for the file leea_agent_sdk-0.0.3.tar.gz.

File metadata

  • Download URL: leea_agent_sdk-0.0.3.tar.gz
  • Upload date:
  • Size: 9.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for leea_agent_sdk-0.0.3.tar.gz
Algorithm Hash digest
SHA256 c726212734b14612d61debf8fac24bb0628e0913d8373210c22de8698e27bc1b
MD5 1c93f72de46371db2e78c06246bf8c99
BLAKE2b-256 7e418902151d1782de7386f856b589388e1b17e3c61b38b75faac8c94b648192

See more details on using hashes here.

Provenance

The following attestation bundles were made for leea_agent_sdk-0.0.3.tar.gz:

Publisher: publish.yml on Leea-Labs/leea-agent-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file leea_agent_sdk-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: leea_agent_sdk-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 9.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for leea_agent_sdk-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2562b77885b9715b725b6219827241d03f4ed80029a0dadc35f962a4051a6e0c
MD5 7701ebc70c796420a1eeaa78454a4a24
BLAKE2b-256 11075f6c1fec2c05bfea666f3e723fddc236dab007a3ef706935b7c5ddb01e51

See more details on using hashes here.

Provenance

The following attestation bundles were made for leea_agent_sdk-0.0.3-py3-none-any.whl:

Publisher: publish.yml on Leea-Labs/leea-agent-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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