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.6.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.6-py3-none-any.whl (9.1 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: leea_agent_sdk-0.0.6.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.6.tar.gz
Algorithm Hash digest
SHA256 a0caa7f6218f7954266beda7eb75eacc5b421158ad6867f4639088f41c1fda3d
MD5 20b5fd0650d66ce77f5153ff29e9c83f
BLAKE2b-256 37d6441075ae428a4e8fd25090e9113fad3538e3f739ba043927158ddb0a454c

See more details on using hashes here.

Provenance

The following attestation bundles were made for leea_agent_sdk-0.0.6.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.6-py3-none-any.whl.

File metadata

  • Download URL: leea_agent_sdk-0.0.6-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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 644f79d186737c78acb9a61af98f31093206ddb95ee286abc452cf550e230a45
MD5 4699a2bbe3621dd062da3d7e88416902
BLAKE2b-256 82ff14d552162c9b7f22b4eaa9ed87c27952cb46a0317928b79962229760b620

See more details on using hashes here.

Provenance

The following attestation bundles were made for leea_agent_sdk-0.0.6-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