diff --git a/ra_aid/agent_utils.py b/ra_aid/agent_utils.py index c11fdfa..d281185 100644 --- a/ra_aid/agent_utils.py +++ b/ra_aid/agent_utils.py @@ -422,6 +422,8 @@ def run_task_implementation_agent( try: logger.debug("Implementation agent completed successfully") return run_agent_with_retry(agent, prompt, run_config) + except (KeyboardInterrupt, AgentInterrupt): + raise except Exception as e: logger.error("Implementation agent failed: %s", str(e), exc_info=True) raise diff --git a/ra_aid/agents/__init__.py b/ra_aid/agents/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/ra_aid/agents/ciayn_agent.py b/ra_aid/agents/ciayn_agent.py index cb9f06f..7d4dde7 100644 --- a/ra_aid/agents/ciayn_agent.py +++ b/ra_aid/agents/ciayn_agent.py @@ -4,6 +4,36 @@ from langchain_core.messages import AIMessage, HumanMessage, BaseMessage from ra_aid.exceptions import ToolExecutionError class CiaynAgent: + """Code Is All You Need (CIAYN) agent that uses generated Python code for tool interaction. + + The CIAYN philosophy emphasizes direct code generation and execution over structured APIs: + - Language model generates executable Python code snippets + - Tools are invoked through natural Python code rather than fixed schemas + - Flexible and adaptable approach to tool usage through dynamic code + - Complex workflows emerge from composing code segments + + Code Generation & Function Calling: + - Dynamic generation of Python code for tool invocation + - Handles complex nested function calls and argument structures + - Natural integration of tool outputs into Python data flow + - Runtime code composition for multi-step operations + + ReAct Pattern Implementation: + - Observation: Captures tool execution results + - Reasoning: Analyzes outputs to determine next steps + - Action: Generates and executes appropriate code + - Reflection: Updates state and plans next iteration + - Maintains conversation context across iterations + + Core Capabilities: + - Dynamic tool registration with automatic documentation + - Sandboxed code execution environment + - Token-aware chat history management + - Comprehensive error handling and recovery + - Streaming interface for real-time interaction + - Memory management with configurable limits + """ + def _get_function_info(self, func): """ Returns a well-formatted string containing the function signature and docstring,