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:
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:
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 usagemulti_agent_flow.py: Complex multi-agent workflowtool_test.py: Tool integration examplesrag_agent_example.py: Knowledge-based agent with RAG capabilitiesblog_writer_flow.py: Content generation workflowmaldives_trip_planner.py: Travel planning agent system
Development
To contribute to the project:
- Clone the repository
- Install development dependencies:
pip install -e .[dev]
- Run tests:
pytest
Metadata
Release files for hawkins-agent-lib 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hawkins_agent_lib-0.1.8.tar.gz | 24.6 kB | Without provenance | Details for hawkins_agent_lib-0.1.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hawkins_agent_lib-0.1.8-py3-none-any.whl | Python 3 | none | any | Details for hawkins_agent_lib-0.1.8-py3-none-any.whl |
Total release size: 57.4 kB
Release files / hawkins_agent_lib-0.1.8.tar.gz
| Download URL | hawkins_agent_lib-0.1.8.tar.gz |
|---|---|
| Size | 24.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cefa57274e3757246f4a46fbf419070d92138438ed95e257cc5ce6d8ebc0db5c
|
|
BLAKE2b-256 checksum How to use checksums |
5191cce300e4ed4efc7e6c52c8e6f412601513eb234ef755762baa9010a8b03d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.11.10
|
Release files / hawkins_agent_lib-0.1.8-py3-none-any.whl
| Download URL | hawkins_agent_lib-0.1.8-py3-none-any.whl |
|---|---|
| Size | 32.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
204a4a814904a4be978e64be8f7ae804797c007782e5f873b30ba63298422fd6
|
|
BLAKE2b-256 checksum How to use checksums |
9b6b098f8b302a3bd51ef3d8a902c535462f9fa04823e8e328d643098d9246b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.11.10
|
Security for hawkins-agent-lib 0.1.8
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.