You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,20 @@ Thank you for your interest in contributing to AmritaCore! This guide will help
6
6
7
7
Before participating in the project, please read our [Code of Conduct](./CODE_OF_CONDUCT.md) and abide by its provisions.
8
8
9
+
## AIGC Content Licensing Policy
10
+
11
+
We welcome the use of AI-generated content as a tool to enhance development efficiency, while maintaining high standards for code quality and integrity:
12
+
13
+
1.**AI as a Tool**: The use of AI for code generation is recognized as a technological advancement and valuable productivity tool.
14
+
15
+
2.**Core Business Logic**: All core business logic code must be written manually by developers and undergo thorough code review. AI-generated core business logic will not be accepted.
16
+
17
+
3.**Documentation**: AI-generated documentation is permitted, but must strictly conform to the project's API definitions and specifications.
18
+
19
+
4.**Tests**: Test cases may be generated using LLMs, but must provide complete coverage of the corresponding code lines, logical branches, and edge cases.
20
+
21
+
5.**Review Requirement**: All AI-generated content, regardless of type, must be reviewed and validated by human contributors before submission.
The AgentRuntime class is a high-level wrapper around ChatObject that provides a reusable agent operation interface.
4
+
5
+
This class encapsulates the complexity of ChatObject and provides a simplified API for agent interactions. It maintains session state, configuration, and strategy settings, making it a reusable object for multiple agent operations within the same context.
6
+
7
+
## Properties
8
+
9
+
-`strategy` (type[AgentStrategy]): Agent strategy class used for execution
10
+
-`session_id` (str): Session ID for the agent
11
+
-`session` (SessionData | None): Session data or None if no session
12
+
-`preset` (ModelPreset): Model preset configuration
-`train` (Message[str]): Training data (system prompts)
15
+
-`context` (MemoryModel): Memory context for the conversation
16
+
-`template` (Template): Jinja2 template used to render system role message
17
+
18
+
## Constructor Parameters
19
+
20
+
-`config` ([AmritaConfig](AmritaConfig.md)): Amrita configuration object containing global configuration settings
21
+
-`preset` ([ModelPreset](ModelPreset.md)): Model preset configuration defining basic model parameters and settings
22
+
-`strategy` (type[AgentStrategy], optional): Agent strategy class, defaults to AmritaAgentStrategy
23
+
-`template` (Template | str, optional): Train template to render system role message, defaults to DEFAULT_TEMPLATE
24
+
-`session` (SessionData | str | None, optional): Session data or session ID string for restoring existing sessions. If None, a new session will be created
25
+
-`train` (dict[str, str] | Message[str] | None, optional): Training data (system prompts), can be in dictionary format or as a Message object
26
+
-`no_session` (bool, optional): Whether to disable session functionality. If True, session management will be disabled but a temporary session ID will still be assigned
27
+
28
+
## Methods
29
+
30
+
### set_strategy(strategy)
31
+
32
+
Set the agent strategy to be used for execution.
33
+
34
+
**Parameters**:
35
+
36
+
-`strategy` (type[AgentStrategy]): The agent strategy to be used for execution
37
+
38
+
### get_chatobject(input, \*\*kwargs)
39
+
40
+
Get a chat object for a specific interaction.
41
+
42
+
**Parameters**:
43
+
44
+
-`input` (USER_INPUT): Input from the user
45
+
-`**kwargs`: Additional keyword arguments passed to ChatObject constructor
46
+
47
+
**Returns**: [ChatObject](ChatObject.md) - A configured ChatObject instance ready for execution
The AgentStrategy abstract base class defines how an agent should execute its workflow.
4
+
5
+
This class provides a unified interface for different types of agent execution strategies, allowing the system to support various agent patterns (basic tool calling, RAG, complex workflows).
6
+
7
+
## Strategy Categories
8
+
9
+
Different strategy categories have different execution patterns:
10
+
11
+
-**'agent'**: Uses `single_execute()` method for step-by-step tool calling, managed by the framework
12
+
-**'rag'**: Uses `run()` method with minimal context (only system message and user query)
13
+
-**'workflow'**: Uses `run()` method with full manual control over tool calling and context management
14
+
-**'agent-mixed'**: Uses `single_execute()` method but can handle both RAG and Agent modes dynamically
15
+
16
+
## Properties
17
+
18
+
-`session` (SessionData | None): The session data associated with the current chat session, or None if not available
19
+
-`tools_manager` (MultiToolsManager): Manager for handling available tools in the current context
20
+
-`chat_object` (ChatObject): The chat object for yielding responses and managing the conversation flow
21
+
-`ctx` (StrategyContext): The strategy context containing execution parameters and configuration
22
+
23
+
## Constructor Parameters
24
+
25
+
-`ctx` ([StrategyContext](StrategyContext.md)): Strategy context containing chat_object, configuration, and message context
26
+
27
+
## Abstract Methods
28
+
29
+
### get_category()
30
+
31
+
Get the category of the agent strategy.
32
+
33
+
**Returns**: Literal["agent", "workflow", "rag", "agent-mixed"] - The strategy category as a literal string indicating execution pattern.
34
+
35
+
## Methods
36
+
37
+
### single_execute()
38
+
39
+
Execute a single agent step for 'agent' and 'agent-mixed' category strategies.
40
+
41
+
This method is called by the framework to perform one iteration of tool calling. The framework handles the loop management, call counting, and termination conditions.
42
+
43
+
**Returns**: bool - True if should continue to next execution, False to stop.
44
+
45
+
**Note**: This method is used by 'agent' and 'agent-mixed' category strategies. 'rag' and 'workflow' category strategies should implement `run()` instead.
46
+
47
+
### run()
48
+
49
+
Run the complete agent strategy for 'rag' and 'workflow' category strategies.
50
+
51
+
This method gives full control to the strategy implementation for managing tool calling iterations, context construction, error handling, and response generation.
52
+
53
+
**Note**: This method is used by 'rag' and 'workflow' category strategies. 'agent' and 'agent-mixed' category strategies should implement `single_execute()` instead.
54
+
55
+
### on_limited()
56
+
57
+
Handle the event when the agent reaches its tool calling limit.
58
+
59
+
This method is called when the agent strategy has reached the maximum allowed number of tool calls as configured by the framework.
60
+
61
+
### on_exception(exc)
62
+
63
+
Handle exceptions that occur during strategy execution.
64
+
65
+
**Parameters**:
66
+
-`exc` (BaseException): The exception that occurred during execution
0 commit comments