-
Notifications
You must be signed in to change notification settings - Fork 20
feat: conversational agent support #1087
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
base: main
Are you sure you want to change the base?
Conversation
08ce88b to
6843216
Compare
160bdb1 to
049870f
Compare
049870f to
464caaa
Compare
| "--keep-state-file", | ||
| is_flag=True, | ||
| help="Keep the state file even when not resuming and no job id is provided", | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's replace this with:
@click.option(
"--state-file",
required=False,
type=click.Path(exists=True),
help="Full path to the state file (takes priority over default location)"
)Trying to shoot two birds with one stone, if we have this specified, we just use it as an override and don't delete it. Updated the runtime PR as well https://github.com/UiPath/uipath-runtime-python/pull/65/changes
We need to update the pyproject.toml with the new runtime version range + increment the minor here as well
| resume=resume, | ||
| command="run", | ||
| trace_manager=trace_manager, | ||
| keep_state_file=keep_state_file, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
state_file_path=state_file
|
|
||
| def generate_conversational_agent_system_prompt( | ||
| agent_definition: LowCodeAgentDefinition, | ||
| user_settings: Optional[PromptUserSettings], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's change this method's signature to only use what it needs from LowCodeAgentDefinition (agent_name str, model str, system_message). we need to re-use it for the conversion flow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for reference, this is how a converted autonomous low-code agent looks today:
class AgentInput(BaseModel):
pass
class AgentOutput(BaseModel):
content: str | None = Field(None, description="Output content")
# Agent Messages Function
def create_messages(state: AgentInput) -> Sequence[SystemMessage | HumanMessage]:
# Apply system prompt template
current_date = datetime.now(timezone.utc).strftime('%Y-%m-%d')
system_prompt_content = f"""You are an agentic assistant."""
enhanced_system_prompt = (
AGENT_SYSTEM_PROMPT_TEMPLATE
.replace('{{systemPrompt}}', system_prompt_content)
.replace('{{currentDate}}', current_date)
.replace('{{agentName}}', 'Mr Assistant')
)
return [
SystemMessage(content=enhanced_system_prompt),
HumanMessage(content=f"""What is the current date?"""),
]
# Create agent graph
graph = create_agent(model=llm, messages=create_messages, tools=all_tools, input_schema=AgentInput, output_schema=AgentOutput)| import os | ||
| import uuid | ||
| from typing import Any | ||
| from typing import Any, Dict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we use buit-in types (dict not Dict, x | None instead of Optional etc)
Depends on UiPath/uipath-runtime-python#65
Adds support for conversational agents:
Also