hawkins-agent


Namehawkins-agent JSON
Version 0.1.8 PyPI version JSON
download
home_pagehttps://github.com/hawkins-ai/hawkins-agent
SummaryA Python SDK for building AI agents with minimal code using Hawkins ecosystem with HawkinDB memory
upload_time2025-02-26 04:55:01
maintainerNone
docs_urlNone
authorHarish Santhanalakshmi Ganesan
requires_python>=3.11
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            pip install hawkins-agent
```

Requires Python 3.11 or higher.

## Quick Start

Here's a simple example to get you started:

```python
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

### RAG-Enabled Knowledge Assistant

Create an agent that can answer questions based on its knowledge base:

```python
from hawkins_agent import AgentBuilder
from hawkins_agent.tools import RAGTool
from hawkins_rag import HawkinsRAG

# Initialize RAG system and tool
rag = HawkinsRAG()
rag_tool = RAGTool(knowledge_base=rag)

# Create agent with RAG capabilities
agent = (AgentBuilder("knowledge_assistant")
        .with_model("gpt-4o")
        .with_tool(rag_tool)
        .build())

# Add documents to knowledge base
await rag_tool.add_document(
    content="Document content...",
    metadata={"topic": "AI", "source": "research_paper"}
)

# Query the knowledge base
response = await agent.process("What are the key findings in the AI research?")
print(response.message)
```

### Multi-Agent Workflow

Create complex workflows with multiple specialized agents:

```python
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:

```python
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:
- [Flow System Documentation](docs/flows.md)
- [Custom Tools Guide](docs/custom_tools.md)
- [Memory Management](docs/memory_management.md)
- [API Reference](docs/api_reference.md)

## 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
- `rag_agent_example.py`: Knowledge-based agent with RAG capabilities
- `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:
```bash
pip install -e .[dev]
```
3. Run tests:
```bash
pytest

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hawkins-ai/hawkins-agent",
    "name": "hawkins-agent",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": null,
    "author": "Harish Santhanalakshmi Ganesan",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/88/4a/021c35a4617459f0a3b993efc4d35ce595d0e1231a8fb9a92daa383fbcc9/hawkins_agent-0.1.8.tar.gz",
    "platform": null,
    "description": "pip install hawkins-agent\n```\n\nRequires Python 3.11 or higher.\n\n## Quick Start\n\nHere's a simple example to get you started:\n\n```python\nfrom hawkins_agent import AgentBuilder\nfrom hawkins_agent.tools import WebSearchTool\nfrom hawkins_agent.mock import KnowledgeBase\n\nasync def main():\n    # Create a knowledge base\n    kb = KnowledgeBase()\n\n    # Create agent with web search capabilities\n    agent = (AgentBuilder(\"researcher\")\n            .with_model(\"gpt-4o\")\n            .with_knowledge_base(kb)\n            .with_tool(WebSearchTool())\n            .build())\n\n    # Process a query\n    response = await agent.process(\"What are the latest developments in AI?\")\n    print(response.message)\n\nif __name__ == \"__main__\":\n    import asyncio\n    asyncio.run(main())\n```\n\n## Advanced Usage\n\n### RAG-Enabled Knowledge Assistant\n\nCreate an agent that can answer questions based on its knowledge base:\n\n```python\nfrom hawkins_agent import AgentBuilder\nfrom hawkins_agent.tools import RAGTool\nfrom hawkins_rag import HawkinsRAG\n\n# Initialize RAG system and tool\nrag = HawkinsRAG()\nrag_tool = RAGTool(knowledge_base=rag)\n\n# Create agent with RAG capabilities\nagent = (AgentBuilder(\"knowledge_assistant\")\n        .with_model(\"gpt-4o\")\n        .with_tool(rag_tool)\n        .build())\n\n# Add documents to knowledge base\nawait rag_tool.add_document(\n    content=\"Document content...\",\n    metadata={\"topic\": \"AI\", \"source\": \"research_paper\"}\n)\n\n# Query the knowledge base\nresponse = await agent.process(\"What are the key findings in the AI research?\")\nprint(response.message)\n```\n\n### Multi-Agent Workflow\n\nCreate complex workflows with multiple specialized agents:\n\n```python\nfrom hawkins_agent import AgentBuilder, FlowManager, FlowStep\nfrom hawkins_agent.tools import WebSearchTool, WeatherTool\n\n# Create specialized agents\nresearch_agent = (AgentBuilder(\"researcher\")\n                .with_model(\"gpt-4o\")\n                .with_tool(WebSearchTool())\n                .build())\n\nwriter_agent = (AgentBuilder(\"writer\")\n              .with_model(\"gpt-4o\")\n              .build())\n\n# Create flow manager\nflow = FlowManager()\n\n# Define workflow steps\nasync def research_step(input_data, context):\n    query = input_data.get(\"topic\")\n    result = await research_agent.process(f\"Research this topic: {query}\")\n    return {\"research\": result.message}\n\nasync def writing_step(input_data, context):\n    research = context.get(\"research\", {}).get(\"research\")\n    result = await writer_agent.process(f\"Write an article based on: {research}\")\n    return {\"article\": result.message}\n\n# Add steps to flow\nflow.add_step(FlowStep(\n    name=\"research\",\n    agent=research_agent,\n    process=research_step\n))\n\nflow.add_step(FlowStep(\n    name=\"writing\",\n    agent=writer_agent,\n    process=writing_step,\n    requires=[\"research\"]\n))\n\n# Execute flow\nresults = await flow.execute({\"topic\": \"AI trends in 2024\"})\n```\n\n### Using Custom Tools\n\nCreate your own tools by extending the BaseTool class:\n\n```python\nfrom hawkins_agent.tools.base import BaseTool\nfrom hawkins_agent.types import ToolResponse\n\nclass CustomTool(BaseTool):\n    name = \"custom_tool\"\n    description = \"A custom tool for specific tasks\"\n\n    async def execute(self, query: str) -> ToolResponse:\n        try:\n            # Tool implementation here\n            result = await self._process(query)\n            return ToolResponse(success=True, result=result)\n        except Exception as e:\n            return ToolResponse(success=False, error=str(e))\n```\n\n## Documentation\n\nFor more detailed documentation, see:\n- [Flow System Documentation](docs/flows.md)\n- [Custom Tools Guide](docs/custom_tools.md)\n- [Memory Management](docs/memory_management.md)\n- [API Reference](docs/api_reference.md)\n\n## Examples\n\nThe `examples/` directory contains several example implementations:\n- `simple_agent.py`: Basic agent usage\n- `multi_agent_flow.py`: Complex multi-agent workflow\n- `tool_test.py`: Tool integration examples\n- `rag_agent_example.py`: Knowledge-based agent with RAG capabilities\n- `blog_writer_flow.py`: Content generation workflow\n- `maldives_trip_planner.py`: Travel planning agent system\n\n## Development\n\nTo contribute to the project:\n\n1. Clone the repository\n2. Install development dependencies:\n```bash\npip install -e .[dev]\n```\n3. Run tests:\n```bash\npytest\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python SDK for building AI agents with minimal code using Hawkins ecosystem with HawkinDB memory",
    "version": "0.1.8",
    "project_urls": {
        "Documentation": "https://github.com/hawkins-ai/hawkins-agent#readme",
        "Homepage": "https://github.com/hawkins-ai/hawkins-agent",
        "Source": "https://github.com/hawkins-ai/hawkins-agent"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "985de5c2468cf04cbd31a0399c301890039e44ccfe991912a96e3f0a08901579",
                "md5": "f9a2e66d5256daf965eef720a1a4c2ca",
                "sha256": "56ecf306a5516c3399872bc0628d87df1a6dfbad6be04f5cc9c4437274dd1b24"
            },
            "downloads": -1,
            "filename": "hawkins_agent-0.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f9a2e66d5256daf965eef720a1a4c2ca",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 33428,
            "upload_time": "2025-02-26T04:49:40",
            "upload_time_iso_8601": "2025-02-26T04:49:40.641300Z",
            "url": "https://files.pythonhosted.org/packages/98/5d/e5c2468cf04cbd31a0399c301890039e44ccfe991912a96e3f0a08901579/hawkins_agent-0.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "884a021c35a4617459f0a3b993efc4d35ce595d0e1231a8fb9a92daa383fbcc9",
                "md5": "2e3051d2ef4f10c12be94bcfba0d170a",
                "sha256": "28f008e0dd79a925deb49f2ea2c7a300973b131f5cbe98bc0f901a25ac3746ed"
            },
            "downloads": -1,
            "filename": "hawkins_agent-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "2e3051d2ef4f10c12be94bcfba0d170a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 25249,
            "upload_time": "2025-02-26T04:55:01",
            "upload_time_iso_8601": "2025-02-26T04:55:01.305187Z",
            "url": "https://files.pythonhosted.org/packages/88/4a/021c35a4617459f0a3b993efc4d35ce595d0e1231a8fb9a92daa383fbcc9/hawkins_agent-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-26 04:55:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hawkins-ai",
    "github_project": "hawkins-agent",
    "github_not_found": true,
    "lcname": "hawkins-agent"
}
        
Elapsed time: 0.87858s