Skip to main content

A Python SDK for building AI agents with minimal code using Hawkins ecosystem with HawkinDB memory

Project description

Hawkins Agent Framework

A Python SDK for building AI agents with minimal code using the Hawkins ecosystem. This framework integrates key tools and services for building functional AI agents.

Version Python License

Features

  • Seamless LLM Integration: Built-in support for LiteLLM, enabling easy integration with various language models
  • Web Search Capabilities: Integrated Tavily search functionality for real-time information retrieval
  • Memory Management: HawkinDB integration for efficient agent memory storage and retrieval
  • Multi-Agent Orchestration: Advanced flow control system for coordinating multiple agents
  • Tool Integration: Extensible tool system with pre-built tools for common tasks
  • Email Functionality: Built-in email capabilities for agent communication
  • Asynchronous Design: Built with modern async/await patterns for optimal performance

Installation

pip install hawkins-agent

Requires Python 3.11 or higher.

Quick Start

Here's a simple example to get you started:

from hawkins_agent import AgentBuilder
from hawkins_agent.tools import WebSearchTool
from hawkins_agent.mock import KnowledgeBase

async def main():
    # Create a knowledge base
    kb = KnowledgeBase()
    
    # Create agent with web search capabilities
    agent = (AgentBuilder("researcher")
            .with_model("gpt-4o")
            .with_knowledge_base(kb)
            .with_tool(WebSearchTool())
            .build())
    
    # Process a query
    response = await agent.process("What are the latest developments in AI?")
    print(response.message)

if __name__ == "__main__":
    import asyncio
    asyncio.run(main())

Advanced Usage

Multi-Agent Workflow

Create complex workflows with multiple specialized agents:

from hawkins_agent import AgentBuilder, FlowManager, FlowStep
from hawkins_agent.tools import WebSearchTool, WeatherTool

# Create specialized agents
research_agent = (AgentBuilder("researcher")
                .with_model("gpt-4o")
                .with_tool(WebSearchTool())
                .build())

writer_agent = (AgentBuilder("writer")
              .with_model("gpt-4o")
              .build())

# Create flow manager
flow = FlowManager()

# Define workflow steps
async def research_step(input_data, context):
    query = input_data.get("topic")
    result = await research_agent.process(f"Research this topic: {query}")
    return {"research": result.message}

async def writing_step(input_data, context):
    research = context.get("research", {}).get("research")
    result = await writer_agent.process(f"Write an article based on: {research}")
    return {"article": result.message}

# Add steps to flow
flow.add_step(FlowStep(
    name="research",
    agent=research_agent,
    process=research_step
))

flow.add_step(FlowStep(
    name="writing",
    agent=writer_agent,
    process=writing_step,
    requires=["research"]
))

# Execute flow
results = await flow.execute({"topic": "AI trends in 2024"})

Using Custom Tools

Create your own tools by extending the BaseTool class:

from hawkins_agent.tools.base import BaseTool
from hawkins_agent.types import ToolResponse

class CustomTool(BaseTool):
    name = "custom_tool"
    description = "A custom tool for specific tasks"
    
    async def execute(self, query: str) -> ToolResponse:
        try:
            # Tool implementation here
            result = await self._process(query)
            return ToolResponse(success=True, result=result)
        except Exception as e:
            return ToolResponse(success=False, error=str(e))

Documentation

For more detailed documentation, see:

Examples

The examples/ directory contains several example implementations:

  • simple_agent.py: Basic agent usage
  • multi_agent_flow.py: Complex multi-agent workflow
  • tool_test.py: Tool integration examples
  • blog_writer_flow.py: Content generation workflow
  • maldives_trip_planner.py: Travel planning agent system

Development

To contribute to the project:

  1. Clone the repository
  2. Install development dependencies:
pip install -e .[dev]
  1. Run tests:
pytest

License

MIT License - see the LICENSE file for details.

Credits

Built with ❤️ by the Hawkins AI team.

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

hawkins_agent-0.1.5.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

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

hawkins_agent-0.1.5-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

File details

Details for the file hawkins_agent-0.1.5.tar.gz.

File metadata

  • Download URL: hawkins_agent-0.1.5.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.10

File hashes

Hashes for hawkins_agent-0.1.5.tar.gz
Algorithm Hash digest
SHA256 972fcba77dd9a91ca666c96c18d26be960e5ea416277ff4d68a61bb26328aaf1
MD5 e290a6fc4ca8583707902cb6515f488d
BLAKE2b-256 ec8038cc0e77996943cc9f18ec14c99630d21aee1a2089722ea903506b1fe76e

See more details on using hashes here.

File details

Details for the file hawkins_agent-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: hawkins_agent-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 29.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.10

File hashes

Hashes for hawkins_agent-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cfabf6eec8d2d5482e0d941f5a4d39b2a6c24de24a98d8ac29b6af064df31aa1
MD5 291233c6f0303ba9197989e9982a9ff2
BLAKE2b-256 1df528f00c5e05f55566246440c85b8460d7422f9dbbb5ec977c38412d403b07

See more details on using hashes here.

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