kodeagent.agents.csv_agent.CSVAnalysisAgent#

class kodeagent.agents.csv_agent.CSVAnalysisAgent(name: str = 'CSV Analyst', model_name: str = 'gemini/gemini-2.0-flash-lite', **kwargs: Any)[source]#

An agent specializing in discovering patterns and insights from CSV data.

Examples

Using a local file:
agent = CSVAnalysisAgent()
# Pass the file path (or URL) directly as a task file
async for response in agent.run(task, files=['/path/to/data.csv']):
    pass
Using a URL:
agent = CSVAnalysisAgent()
async for response in agent.run(task, files=['https://example.com/data.csv']):
    pass

Initialize the CSVAnalysisAgent.

Parameters:
  • name – Name of the agent.

  • model_name – The LLM model to use.

  • **kwargs – Additional arguments passed to ReActAgent.

__init__(name: str = 'CSV Analyst', model_name: str = 'gemini/gemini-2.0-flash-lite', **kwargs: Any) None[source]#

Initialize the CSVAnalysisAgent.

Parameters:
  • name – Name of the agent.

  • model_name – The LLM model to use.

  • **kwargs – Additional arguments passed to ReActAgent.

Methods

__init__([name, model_name])

Initialize the CSVAnalysisAgent.

add_output_file(path)

Record a file generated during task execution.

add_to_history(message)

Add a chat message to the agent's message history.

clear_history()

Clear the agent's message history.

get_history()

Get a formatted string of the agent's message history, excluding the system prompt

get_system_prompt_content()

Return the formatted system prompt string for this agent.

get_tools_description([tools])

Generate a description of all the tools available to the agent.

get_usage_metrics()

Get raw usage metrics as a dictionary.

get_usage_report([include_breakdown])

Get a formatted report of LLM usage for the current/last task.

init_history()

Initialize the agent's message history with the system prompt.

normalize_content(content)

Convert message content to a readable string for Observer.

parse_text_response(text)

Parse text-based response when structured output fails.

post_run()

Perform cleanup after the main run loop.

pre_run()

Pre-run hook to auto-load CSV files and yield initialization logs.

response(rtype, value[, channel, metadata])

Prepare a response to be sent by the agent.

run(task[, files, task_id, max_iterations, ...])

Solve a task using ReAct's TAO loop (or CodeAct's TCO loop).

salvage_response()

When an agent fails to find an answer, salvage what information could be gathered.

Attributes

HISTORY_TRUNCATE_CHARS

artifacts

Returns the list of output files generated during task execution.

current_plan

Returns the current plan for the task.

current_trace

description

filter_tools_for_task

final_answer_found

max_iterations

max_retries

msg_idx_of_new_task

name

persona

planner

purpose

Describe the name, purpose of, and tools available to an agent.

system_prompt

task

tracing_type

work_dir

model_name

tools

litellm_params

id

tool_name_to_func

tool_names

chat_history

usage_tracker

tracer_manager

observer

is_visual_model

task_output_files