- Knowledge Generator — Creates relevant factual information
- Reasoner — Uses generated knowledge to form answers
- Coordinator — Synthesizes multiple reasoning paths into a final answer
Architecture
API Reference
GKPAgent
run() only accepts a single task string (it internally calls the private _run([task])[0]). There is no public batch-processing method that accepts a list of tasks; process each task with a separate run() call if you need to handle multiple queries.
process(query) makes one knowledge call, one reasoner call per knowledge item (one after another), and one coordinator call, so a query costs num_knowledge_items + 2 model calls. It returns:
Each query and its final answer are also added to
agent.conversation.
KnowledgeGenerator
KnowledgeGenerator and Reasoner are not exported from swarms. Import them with from swarms.agents.gkp_agent import KnowledgeGenerator, Reasoner.
Reasoner
Example
Best Practices
- Knowledge Generation: Set appropriate number of knowledge items based on query complexity
- Reasoning Process: Ensure diverse reasoning paths for complex queries. Validate confidence levels.
- Coordination: Review coordination logic for complex scenarios. Validate final answers against source knowledge.
Performance Considerations
- Processing time increases with number of knowledge items
- Complex queries may require more knowledge items
- Consider caching frequently used knowledge
- Monitor token usage for cost optimization