Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new agent components for context management and action routing #5319

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

ogabrielluiz
Copy link
Contributor

This pull request introduces several improvements and new features to the agent components. Key changes include correcting the output model instantiation in LangflowAgent, handling invalid LLM responses in GenerateThoughtComponent, and updating action logging in DecideActionComponent. Additionally, the initial context is now included in the full context output. New components for context management and action routing have been implemented, enhancing the overall functionality and robustness of the agent system.

@github-actions github-actions bot added the enhancement New feature or request label Dec 17, 2024
Copy link

codspeed-hq bot commented Dec 17, 2024

CodSpeed Performance Report

Merging #5319 will degrade performances by 18.22%

Comparing agent-context (197c6af) with main (243055e)

Summary

⚡ 1 improvements
❌ 2 regressions
✅ 12 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main agent-context Change
test_get_and_cache_all_types_dict 1 ms 1.2 ms -13.75%
test_setup_llm_caching 2.1 ms 1.2 ms +77.49%
test_successful_run_with_output_type_any 203 ms 248.2 ms -18.22%

@ogabrielluiz ogabrielluiz marked this pull request as ready for review December 18, 2024 16:59
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Dec 18, 2024
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 8 changed files in this pull request and generated 2 comments.

Files not reviewed (3)
  • src/backend/base/langflow/base/agents/context.py: Evaluated as low risk
  • src/backend/base/langflow/components/agents/agent_context.py: Evaluated as low risk
  • src/backend/base/langflow/components/agents/new_agent.py: Evaluated as low risk
Comments suppressed due to low confidence (3)

src/backend/base/langflow/components/agents/decide_action.py:39

  • Ensure that action.log is a string before updating the context. Use str(action.log) to convert if necessary.
self.agent_context.update_context("Action", action.log)

src/backend/base/langflow/components/agents/execute_action.py:30

  • [nitpick] The error message could be more descriptive. Consider including the action tool name and input in the message.
error_msg = f"Error: Action '{action}' not found in available tools."

src/backend/base/langflow/components/agents/agent_action_router.py:45

  • [nitpick] The context message 'Router Decision' could be more specific to differentiate between different routing decisions.
self.agent_context.update_context("Router Decision", context_message)

@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Dec 18, 2024
@ogabrielluiz ogabrielluiz marked this pull request as draft December 18, 2024 17:16
ogabrielluiz and others added 2 commits December 18, 2024 14:18
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Dec 18, 2024
…rity

- Updated error handling to provide a more descriptive message when an action is not found in available tools.
- The error message now includes the action name directly, enhancing the context for debugging and user feedback.
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Dec 18, 2024
@langflow-ai langflow-ai deleted a comment from Copilot bot Dec 20, 2024
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant